Using Keyboard Query Shortcuts in SQL Server Management Studio

This is something that I wish I had discovered years ago.  I have put together my nine most used queries, functions, or system stored procedures that I use most everyday.

The configuration of the keyboard query shortcuts are buried with in the SSMS.  To get to the correct dialog box, click on the Tools drop down menu and then click on the Options menu item.

Tools Options

In the left panel, navigate under the Environment to the Keyboard and click on Query Shortcuts in the Options dialog box.

DefaultQueryShortcuts

Displayed are the three defaults that can not be changed.  Wish they could because I would replace sp_who with sp_who2.

My recommendations for DBAs (developers would want different queries, functions, or system stored procedures):

Alt+F1    sp_help (default)
Ctrl+F1   sp_helpfile
Ctrl+1    sp_who (default)
Ctrl+2    sp_lock (default)
Ctrl+3    sp_who2
Ctrl+4    select @@version
Ctrl+5    select @@servername
Ctrl+6    sp_spaceused
Ctrl+7    dbcc sqlperf(logspace)
Ctrl+8    xp_fixeddrives
Ctrl+9    xp_readerrorlog 1
Ctrl+0    xp_readerrorlog

Below is what the Options dialog box looks like in my SSMS:

DBAQueryShortcuts

When using the keyboard query shortcuts, the shortcuts being used does not appear in the query window.  The results return just the lower panel.  The example pictured below is of the sp_who2 stored procedure results.

RunQueryShortcuts

Using a stored procedure that can accept a parameter like sp_help.  Highlight the parameter then click on the Alt + F1 keys to run the sp_help stored procedure.

sp_help

Leave a Comment