Drag And Drop Column NamesIn Query Analyzer you can save a lot of time by using this trick instead of typing all the column names of a table Hit F8, this will open Object Browser Navigate to DatabaseName/TableName/Columns Click on the column folder and drag the column folder into the Code Window Upon release you will see that all the column names are in the Code Window

Use ShortcutsDid you know that you can have CTRL + Number key combinations/shortcuts in Query Analyzer? You can set it up so that CTRL + 5 executes sp_who2 for example. I thought everyone already knew this but apparently not; I showed this to 3 coworkers yesterday and they didn't know about it. So how do you set this up? It is pretty easy, select Tools -->Customize from the toolbar. In the Customize tab you will see 3 shortcuts already:

ALT + F1 sp_help

CTRL + 1 sp_who

CTRL + 2 sp_lock

To add your own queries/procedures type or paste the query or stored procedure that you want to execute into one of the empty ones (see picture below)

If you have 4 Query Analyzers applications open it will be available in all 4 of them. I usually have 4 Query Analyzer applications open, one for staging, one for development and one each for one of the production boxes. so if I have to quickly check that a table is the same on all 4 machines I just hit CTRL + 6 in all 4 Query Analyzer applications and I am done.

Why stop at just column names? You can drag and drop table names, stored procedure names, users, exc... This helps alot when you have a schema name like QuestionSeries with tables like Old_to_New_Question_Number and QuestionResponse. Stored procedures can get rather lengthy as well. (ex. ThatOneApplication_DoSomeStuffToTheTable)

You can also use window’s program specific hotkey functions to program way more that 12 hotkeys for any program you have running. The keys behave differently depending on which application is “Active”.

What do you do when drag/drop doesnt work? is there an option to check? All I get is a mouse pointer with a plus sign under it. I havnt found a key combo other than escape that does anything to drop the text on the my query window. thoughts?

If you are still using SSMS 2005 there's a new plugin available that is basically a solution explorer replacement and has common sense tasks like structuring queries, creating folders query sorting etc...

Leave a Comment

About Denis Gobo

I was born in Croatia in 1970, when I was one I moved to Amsterdam (and yes Ajax is THE team in Holland) and finally in 1993 I came to the US. I have lived in New York City for a bunch of years and currently live in Princeton, New Jersey with my wife and 3 kids. I work for Dow Jones as a Database architect in the indexes department, one drawback: since our data goes back all the way to May 1896 I cannot use smalldates ;-( I have been working with SQL server since version 6.5 and compared to all the other bloggers here I am a n00b. Some of you might know me from http://sqlservercode.blogspot.com/ or even from some of the newsgroups where I go by the name Denis the SQL Menace If you are a Tek-Tips user then you might know me by the name SQLDenis, I am one of the guys answering SQL Questions in the SQL Programming forum.