by brad
12. November 2007 14:06
My favorite SQL Server Management Studio trick is assigning USE statements to keyboard shortcuts so I don't have to manually change databases by using the drop-down in the SQL Editor toolbar.
Under Options, Environment, you'll find a Keyboard section that allows you to bind a SQL statement to a keyboard shorcut. Pick your favorite databases, assign "USE MyDatabase" to a keyboard shortcut, and you'll never have to use that drop-down again.

This is great, because you can go from desktop to query without every touching your mouse.
1. Launch Management Studio using your favorite application launcher (or by typing "SqlWB" at the Run promt)
2. Type in the name of the server and hit [Enter]
3. [CTRL + N] to open a new query window
4. [CTRL + 3] to execute "USE MyDatabase"
5. Type your query
6. Hit [F5]
My second favorite SQL Server Manage Studio trick is turning on column header copying so my column headers are included when I copy/paste from Management Studio to Excel.
This one is under Options, Query Results, SQL Server, Results to Grid. The goodie you want is "Include column headers when copying or saving the results".

If you're not using Results to Grid, then you can switch back and forth between grid and text by using the [CTRL + D] and [CTRL + T] keyboard shortcuts.
9153495a-8895-41b0-ae68-8d05e9099ef5|0|.0
Tags: