By: Matt Wollner
Keyboard shortcuts play an important role in increasing the productivity of any development environment. There are myriad shortcuts that are highly beneficial in SQL Server Management Studio (SSMS), and SSMS also allows you to easily add your own keyboard shortcuts.
Using a keyboard shortcut in SSMS will add the given code before any SQL that you highlight. Two shortcuts that I add to my SSMS instance are:
SELECT TOP 1000 * FROM
SELECT COUNT(*) FROM
This is simple to set up in SSMS 2005/2008.
- Tools -> Options
- Environment -> Keyboard
- Add the following shortcuts to the Query Shortcuts. I set the SELECT* as the Ctrl+5 because execute is F5, so it is easy to remember. Make sure you include a space after the FROM.
- Ctrl+5: SELECT TOP 1000(*) FROM
- Ctrl+6: SELECT COUNT(*) FROM
- After you apply the changes, make sure you open a new session.
Now that the shortcuts have been setup, all I need to do to get a SELECT TOP 1000 (*) FROM a table is highlight the table name and hit Ctrl+5.
You can also highlight additional code. The shortcut will just append the shortcut text before the highlighted code. In the example below I select the table, an inner join, and a where clause and hit Ctrl+5
Here are some additional shortcuts in SSMS that I find very handy:
Ctrl+R: Hide Show Result Pain
ATL+Q – C – H: Change Connection. (Open Query Window – Connection – Change Connection…)
Ctrl+Shift+R: Refresh the IntelliSense Cache
Keep your data analytics sharp by subscribing to our mailing list
Get fresh Key2 content around Business Intelligence, Data Warehousing, Analytics, and more delivered right to your inbox!
Key2 Consulting is a data warehousing and business intelligence company located in Atlanta, Georgia. We create and deliver custom data warehouse solutions, business intelligence solutions, and custom applications.