SQL Intellisense in WPF Textbox - sql

I am building an application which contains Textbox. I want the Textbox to act just like SQl Server Editor with intellisense. I need help, can i make my Textbox act like a Sql Server Query Editor WITH Intellisense.

What you want cannot be easily achieved on the fly. You have to prepare the following,
Syntax highlighting support so SQL statements can be displayed beautifully.
SQL parser, so that you can provide auto completion suggestions.
You might start from AvalonEdit which is an excellent control that help implement syntax highlighting,
http://www.codeproject.com/Articles/42490/Using-AvalonEdit-WPF-Text-Editor
https://github.com/icsharpcode/SharpDevelop/wiki/AvalonEdit
However, I think it is still your responsibility to write the SQL parser (as #Alexander suggested) and then integrate with AvalonEdit.

Phil Factor worte an excellent blog post at SimpleTalk.com on how to parse SQL using Microsoft's SQLParser with PowerShell. At the top of the post, he has included a link to Dave Ballantyne's Cleaning Up SQL Server Deployment Scripts article, which explains how to obtain SQLParser & further work with it.
While not very specific, hopefully that will at least get you off in the right direction!

Related

SQL, small program to run a query based on the input the user provides

I'm looking into creating a small SQL based program that will run a single query based on an input from a user, but to be honest I know SQL but have no idea on any other Programming language.
Does anyone know if someone has developed something like this, and if so a link to where to find it?
to give an idea,
A windows box pops up with an entry field, that entry field is using the "set #Query" Declarable variable, it then runs a pre-existing SQL Query on that variable and prints to the user the result.
If anything is unclear please let me know
Your humble newbie.
Denslat
You can use sqlcmd utility, it's a part of SQL Server. For more info, see this link.
You don't have to learn new language, you just need to know how to get an user input and call query.
For mode advance situations, you can even couple sqlcmd with PowerShell. See here.
You can install Oracle Database in your system. It has an interactive and batch query tool namely SQL*Plus which has its own command line interface,GUI and web based interface. You can run your own interactive SQL script in its Command Line Interface very easily. In future, for more advanced development, you can use Oracle SQL Developer.
And you need not know any other programming language. Just learn how to get input from user in SQL. Let me know if you face any problem.

XSD to SQL Server conversion

I have a question in regards to the SQLXML for SQL Server.
My assignment is to convert an XSD file so that it magically "becomes" tables in the SQL Server database. I've looked around everywhere, on all the links I could possibly find, but nothing clicks. Everything is like a half-step of what I need to achieve.
I am not too familiar with Visual Studio, haven't done much else than running database queries and all the stuff one likes to do in a SQL Server database. Except for XML.
I figured that SQLXML from Microsoft's MSDN would be a good tool to have (and I believe it's already installed).
Any tips or solutions?
Thanks.
There's no magic involved, and as it's homework/study I won't detail how to do it myself, but if you direct your research towards SQL's Bulk Load functionality it would seem to be what you need.
Read this article for a brief "how to" guide.
Or this article for a detailed description of how to use it.
You can convert XSD to SQL using this approach https://github.com/ujhgj/xsd2sql
But I'm not sure of SQL dialect. That thing worked for Mysql.

How do I create queries to SQL Server tables via Visual Studio when no knowledge about SQL nor Linq?

Let´s be frank, my knowledge regarding SQL language is very low.
Nevertheless, my boss gave me the task to build a database application using the following tools: SQL Server and Visual Studio 2008; C#. I use the VS DataSet as a local mirror of the SQL Server.
And let´s be frank again, my understanding of the VS Query builder is also very small, I´m finding it quite confusing, actually. So no help to find from Query builder.
And my knowledge of Linq is even lower...
Perhaps I should mention that the deadline for the project is "aggressively" set, so I have no chance to learn enough about these things during the project. And I´m a bit stupid too, which is no help when it comes to challenges like this (on other occations it might be quite useful though)
With these permissions, what should I do (except for killing myself or retire) to be able to query my tables in a sufficient way?
Start learning. Look for another job at the same time. Obviously your boss is an idiot - giving you tasks to be not qualified for (or the story is a little different - would not be the first "specialist" trying to find employment that is clueless).
Sorry, I really dont know what else to say here - if yo do not know how to do your job, learn. If that does not work, then you can not do your task. Simple like that.
SQL Query takes a day to get started (on a beginner level). If you do not have this time - get your boss hire someone who has the knowledge.
keep a c# reference book handy. Also a book on sql or you can use sql books online. You can always google for your specific problem or use a forum to get answers. Be optimistic, quit whining and get to your task. All the best.
what type of task you want to do in SQL ? define in Detail.
and start working on the sql it's easy to understand.
there is a visual query designer in visual studio. that might be helpful. Open up server explorer, right click and existing database connection or create a new one and then right click to select 'New Query'.
In the query designer, you can add table and visually add conditions for joins, aggregates etc. and see the query being formed.
Use MS Access:
Start up Access, create a new DB.
Import your SQL Server DB to your new Access DB.
Select Create tab -> Query Wizard -> Simple Query Wizard (and it IS simple to use).
When the query is created, you can use the SQL code in your original SQL Server based application - but as SQL Server and Access aren´t 100% aligned, you might need to do some adjustments - google it up. Here is however a good page that will help you out.
Bonus is that it´s a good way to learn SQL "on the fly".

Code Alignment In SQL Server 2005

I am using SQL Server Management Studio.
I want to know the shortcuts for easily aligning the T-SQL Queries and codes in a beautiful format for easy readability and understandability.
Please Let me know how to align the code without using any SQL Server formatting / aligning tools.
Please do give your valuable tips to align the same, right now to align the code i mean to make the code right and left aligned i m using the TAB and SPACE BAR key which becomes very difficult when the length of code is increasing.
I also find SQL Server Management Studio's lack of auto-formatting a bit frustrating, compared to the functions in Visual Studio.
Consider upgrading to the SQL Server 2008 toolset for a handful of its formatting features. One feature that stands out is that it 'remembers' where you had indented to in the previous line (not sure if this was a 2005 or 2008 feature).
Also consider some online SQL formatting tools:
SQLInform's online SQL formatter - requires Java in your browser.
SQLRefactor from Red Gate - ~$300
Instant SQL Formatter online at dpriver.com Apparently they have a SQL Management Studio plugin for $50
SQL Format at apspot.com
Online code formatting saves an incredible amount of time. If your goal is to quickly format your code, it couldn't get much easier and quicker than copy/paste.

What do you use to write and edit stored procedures in Oracle?

There are many options for editing and writing Stored Procedures in Oracle; what is the best tool for you and why? (one tool per answer.)
Tool for Oracle Application Developers (TOAD), from Quest Software (formerly TOADSoft) has an excellent Stored Procedure editor with syntax highlighting, some autocomplete support (e.g. type in 'TABLE.' and the columns will appear), a nice Execute Procedure option that will show the results in a Grid or show DBMS output, and will also focus on syntax errors when you hit compile.
Note: The Freeware edition only allows 2 concurrent connections to the same Database Instance (even though the website says 5) - that means only 2 developers or DBA's can use it at the same time on the same Database. It also expires every 3 months but they're good at releasing updates.
I recently found the free Oracle SQL Developer.
nice looking GUI (makes you not poke out your eyes like the usual Oracle tools)
has many nice features, like showing tables filtered
lets you connect to multiple oracle instances at once
you can use sane configuration like ip:port username/password and do not have to use those strange TNSNAMES.ORA file based settings
you can set breakpoints and step through the code of stored procedures.
PL/SQL Developer from Allaround Automations.
I happily paid the $200 or so price for this.
Excellent IDE (+ good Intellisense, + debugging capability) with easy creation and editing of PL/SQL packages, SPs, Triggers etc
So much better than Toad.
Toad, from ToadSoft.com -> http://www.toadsoft.com/toad_oracle.htm
For someone like me who likes to work with a DBA tool like Microsoft's SQL Management Studio, it's a life saver.
As a professional PL/SQL developer I use (heh) PL/SQL Developer from Allaround Automations.
I've worked with TOAD for quite a long time but now it is quite overpriced comparing with PL/SQL dev. It has some advantages like knowledge base or ability to work with other RDBMS like SQL server but that's not a necessity for me.
But Notepad++ will always help to make occasional fix.
I always use PL/SQL Developer from Allround Automations.
http://www.allroundautomations.com/plsqldev.html
But some at our place swear by Toad
Use Oracle's own SQL Developer. If you are mainly working with Oracle, it does everything you'll need.
I use TOAD with our Oracle reports development, and I think that it's a good development tool. I normally toggle back and forth between a number of different Oracle instances and schemae, and I like the way that TOAD can display multiple windows for each instance/schema, or even more than one per schema.
TOAD takes a little while to learn and customize, but it's a worthwhile investment. The layout is similar to the Visual Studio .NET IDE with sidebars that can be anchored or rolled away. Tabs display different aspects of the Oracle schema, including procedures, jobs, stats, etc. And when I'm writing SQL, the editor uses color-coding and the error messages are Oracle-specific.
Toolset for Oracle (TOra) is a free, Open Source Database Tool very similar in scope (and look and feel) to Quest's TOAD
Compared to the freeware edition of TOAD, TOra allows multiple connections to different database instances at the same time, and has no concurrent connection limit (so any number of TOra users can be working on the same database instance)
I just used a standard editor (vim which then gave me syntax highlighting).
/Allan
I like SQL Developer from Oracle. Oh and its free! :)
I like Rapid SQL, you can debug SQL too
Notepad++ stays my favourite editor. I had to use SQL Developer in the past, it's not so "bad", but I encountered many problems with it. It proved very unstable so I wouldn't recommend it, or maybe only to test your procedures.
I use JetBrains IDEA (a Java IDE) to edit and SQL*Plus to execute. The advantages of using a tool with local version control, seemless integration into Source Version Control, advanced find and highlighting, great editing, 'live templates' and so on for me outweighs any advantage of having it 'database aware' (which with plug-ins you can get anyway). If I was coding up a complicated query I might fire up SQL Developer, but generally I prefer great text editing features.
I use Oracle SQL Developer - the latest version also has support for CVS and Subversion.
It has the bonus of supporting other database providers, too.
I have used this tool for 2 years and it has now settled down to be reliable.
I've used RapidSQL by Embarcadero on several different DB platforms, and it's awesome. It has an integrated step debugger, too. I haven't actually used it with Oracle, but I know it's supported.
Another vote for Oracle SQL Developer. It's free, it's stable and it does all the basics that I require.
With the mentioned SQL Developer you can even set breakpoints and step through the code of the stored procedure.
Yet another vote for Oracle SQl Developer. But TOAD works too.
A really good text editor with syntax highlighting (e.g. Textpad from www.textpad.com) and SQL Plus.
For me its, Oracle SQL Developer. The learning curve is very minimal if you have worked on IDEs like Eclipse or VS. You can set break points, read live values when you debug stored procs as you would do to code in eclipse/VS.
Ofcourse the UI is a bit sluggish at times but given that its free compensates the sluggishness.
I use Textpad, Clipmate and Quest SQLNavigator. The newer versions of Quest's SQLNavigator and TOAD are crap -- they tend to crash easily and don't play nice with XP/Vista/Win7.
I've spent hours with their tech support and they don't have alternatives.
You get no access to Quest programmers, but rather you get bogged down in their
trouble ticket process.
Quest needs to focus less on integration of different tools into one and selling you
promises that the next version will solve the instability issues.
They need stability.
This means cleaning up their existing codebase or starting over.
More competent programmers, fewer salespeople, fewer tech support people.
Fix the damn problems.
They focus on sales and it's an idiotic business strategy.
This seems to be a problem across the industry.
Quest's TOAD and SQL Navigator have become bloatware and will soon become abandonware
if they don't turn them around and make them more stable.
I copy and paste frequently between Textpad and Quest SQLNavigator because SQLNavigator
crashes and I lose all my sql code up to the point of crash.
I'll probably dump SQLNavigator once I find something more stable.
SQL Developer from Oracle
We have replaced all other tools at our (large well known) enterprise that has over 150 databases and it works just fine. It's not as good as TOAD but it is getting there, and (unlike TOAD) it's free.
SQL Developer also works well enough connecting to SQL Server