Tuesday, 22 December 2009

SSMS handy short cut keys

In Microsoft SQL Server Management Studio, its handy to have some short cut keys to do common tasks.

One handy one I always use is to "select top 100 * from " as I like to highlight a table name and press CTRL+4 to get the top 100 rows instantly.

To set this up, go to Tools->Options->Keyboard. And type "select top 100 * from " without the quotes and making sure you add a space after the from. Very important to leave a space at the end.

Highlight a table and press Ctrl+4 and the top 100 rows will be shown.
SSMS will run your command and append the highlighted text. If your table is called USERS, it would run "select top 100 * from USERS". If you forgot to leave a space at the end, it would try and run "select top 100 * fromUSERS" which won't work.