How to Add Custom Keyboard Shortcuts in SQL Server for Queries Such as SELECT * FROM or sp_helptext
If you 
regularly execute queries such as:

SELECT * FROM TableName
or
EXEC sp_helptext 'StoredProcedureName'

in SQL Server Management Studio (SSMS), 
then you would be sick of repeating them.

You can assign your own keyboard shortcuts to frequently used SQL snippets in SSMS, did you know?

In this guide, we’ll walk through how to configure these shortcuts and speed up your SQL workflow.

Why Use Keyboard Shortcuts in SSMS?
  • Custom shortcuts can help you:
  • Save time on repetitive tasks
  • Reduce typing errors
  • Improve productivity when navigating databases
You can bind common commands like:

SELECT * FROM

EXEC sp_helptext

EXEC sp_help

sp_who2

Any other SQL command or snippet

Add Keyboard Shortcuts in SSMS guide step by step :
Step 1: Open Options in SSMS
In SSMS, go to the Tools menu.

Click on Options.

Click on the Environment section to expand.

Click on Keyboard > Query Shortcuts.

You'll find here a list of 9 keyboard shortcuts that can be customized:



Shortcut
\tDefault Action
Ctrl + 1
\tsp_help
Ctrl + 2\tsp_who
Ctrl + 3\t(empty)
.


Step 2: Add Your Custom Query
You can 
put any SQL code snippet here. For example:

To set up a shortcut for SELECT * FROM, use this:

SELECT * FROM
To set up EXEC sp_helptext, use this:

EXEC sp_helptext
Select an unused slot (such as Ctrl + 3, Ctrl + 4, etc.) and copy the query into it.

Step 3: 
Apply the Shortcut
Now, in any query window:

Type the 
name of the table or stored procedure (e.g. Employees)

Select the name

Press the shortcut (e.g. Ctrl + 3)

Example:

-- Select this
Employees
-- Press Ctrl + 3
-- Result:
SELECT * FROM Employees
If your shortcut was:

SELECT * FROM
It will add that at the beginning of the chosen word automatically.

Tips :
Shortcuts 
operate on chosen text — always select the object name to start with.

You 
may overwrite existing shortcuts if you never use them (such as Ctrl + 2 for sp_who).

You 
may assign shortcuts to:

SELECT COUNT(*)
FROM

sp_helpindex

DBCC SHOWCONTIG

SELECT name FROM sysobjects WHERE type = 'P'

How to Reset Shortcuts
To reset to defaults:

Navigate to Tools > Options > Keyboard > Query Shortcuts

Press Reset

This will 
restore default sp_help and sp_who mappings.
Some times it not works so , after adding shortcut  , close the MSSMS and open it again , Now will work

🙏 Thank You for Reading!

Thank you for taking the time to read this blog!

If you have any questions or need help with something, feel free to drop a message in the comments or contact section. I’ll get back to you as soon as possible.

Happy Learning! 😊

Leave a Reply

Your email address will not be published. Required fields are marked *


Talk to us?

Post your blog

F.A.Q

Frequently Asked Questions