Click here to Skip to main content
15,881,173 members
Articles / Database Development / SQL Server

Keyboard Query Shortcuts In SQL Server Management Studio

Rate me:
Please Sign up or sign in to vote.
4.29/5 (8 votes)
12 May 2016CPOL2 min read 17.3K   6   7
Some shortcuts that may be useful to you when you work with SQL Server Management Studio

In this article, we are going to see some shortcuts that may be useful to you when you work with SQL Server Management Studio. You can always use some custom queries too as query shortcuts in SSMS. Here, I am going to show some queries shortcuts that are widely used. I hope you will like this.

Background

If you are a .NET developer or if you are working with any Microsoft technologies, you must have some experience in working with SQL and SQL Server Management Studio. But as a developer, we always try to achieve the things in a simple manner. Isn’t it? This is where we are going for keyboard shortcuts. We do have an option to set and use the keyboard shortcuts in SSMS too. I will explain those.

Keyboard Query Shortcuts In SSMS

First of all, let me tell you an example of where we can use the keyboard shortcuts. We know how to create stored procedures right? There procedures are created in a folder called ‘Stored Procedures’ under Programmability. Now, let us assume that I have a stored procedure with name as usp_Get_SalesOrderDetail. Now if you need to see the queries we have written in that stored procedure, what will you do? You have two options:

  • Right click on the stored procedure and click on modify
  • Use the sp_helptext as sp_helptext usp_Get_SalesOrderDetail

Now my question is, in this scenario, whenever you need to see the stored procedure, you need to type sp_helptext right? How can we overcome this situation? Here, we can set the keyboard shortcuts.

Setting the Keyboard Shortcuts

Go to Tools -> Options.

Tools_Options

Tools_Options

Go to Environment -> Keyboard -> Query Shortcuts

Environment_Keyboard_Query_Shortcuts_

Environment_Keyboard_Query_Shortcuts_

On the right side, you can see some shortcuts which are by default in SSMS. Now if you need to add a new one, just click on any column under Stored Procedure column.

Adding_a_new_keyboard_shortcut

Adding_a_new_keyboard_shortcut

Click OK. Now please go to a query window and select the stored procedure, then press CTRL+3, it will show the stored procedure.

sp_helptext_Results_

sp_helptext_Results

Now if you need to select all the records from a table when you select the table and press CTRL+5 (You can select any key), you can make the shortcut as follows:

Selct_Query_As_Keyboard_Shortcut

Selct_Query_As_Keyboard_Shortcut

Now please go ahead and select the table name from the query window and press CTRL+4 (the key we selected). I hope you got the result as expected.

Happy coding!

Conclusion

Did I miss anything that you may think  is needed? Could you find this post useful? I hope you liked this article. Please share your valuable suggestions and feedback.

Your Turn. What Do You Think?

A blog isn’t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, ASP.NET Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I can.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Germany Germany
I am Sibeesh Venu, an engineer by profession and writer by passion. I’m neither an expert nor a guru. I have been awarded Microsoft MVP 3 times, C# Corner MVP 5 times, DZone MVB. I always love to learn new technologies, and I strongly believe that the one who stops learning is old.

My Blog: Sibeesh Passion
My Website: Sibeesh Venu

Comments and Discussions

 
QuestionYou need only one shortcut... Pin
Thornik14-May-16 9:11
Thornik14-May-16 9:11 
GeneralMy vote of 5 Pin
OmPrakash_toss13-May-16 20:18
OmPrakash_toss13-May-16 20:18 
GeneralRe: My vote of 5 Pin
Sibeesh Passion13-May-16 22:29
professionalSibeesh Passion13-May-16 22:29 
Thanks much for your feedback. I really appreciate it.
==================!!!====================!!!========================
So much complexity in software comes from trying to make one thing do two things.
Kindest Regards
Sibeesh Venu
http://sibeeshpassion.com/

QuestionUseful Information Pin
Varsha Ramnani12-May-16 19:44
professionalVarsha Ramnani12-May-16 19:44 
AnswerRe: Useful Information Pin
Sibeesh Passion12-May-16 21:18
professionalSibeesh Passion12-May-16 21:18 
AnswerRe: Useful Information Pin
Member 1160189714-May-16 3:30
Member 1160189714-May-16 3:30 
GeneralRe: Useful Information Pin
Sibeesh Passion14-May-16 14:00
professionalSibeesh Passion14-May-16 14:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.