How To Create Custom Keyboard Shortcut In SQL Server

Posted May 7, 2019 by Vishwanath Dalvi in Database, SQL Server

How To Create Custom Keyboard Shortcut In SQL Server

Using a keyboard shortcut saves time and effort. Every smart developer should know a handful of keyboard shortcuts to increase productivity. SQL Server includes numerous keyboard shortcuts for developers to increase efficiency. Important to learn and try them out to speed up the development. You can save a lot of time and efforts by assigning a custom keyboard shortcut to repeatedly executed queries.

Moreover, SQL server allows adding custom keyboard shortcuts. We can add our own queries, options as a shortcut for speed-up.

Assuming we need to run a query on various tables repeatedly to get the top 10 records. Similarly, executing sp_helptext to see the object’s source code.

Here is how we can create a custom keyboard shortcut in SQL Server.

Create Custom Keyboard Shortcut In SQL Server


1.In SSMS, choose Tools > Options.

2.In Options box, go to Environment > Keyboard > Query Shortcuts. You can see that by default SQL server has assigned some keyboard shortcuts in SSMS.

3.On the right side, we need to add our queries next to defined keyboard shortcuts. Here we are adding select top 10 * from query next to CTRL + 3. Likewise, adding sp_helptext query option next to CTRL + 4.

Custom Keyboard Shortcut In SQL Server

Now we successfully added a custom keyboard shortcut. Let’s verify them. Highlight any table name and press CTRL + 3 (custom keyboard shortcut) to see the top 10 records. In the following screen, I have highlighted sys.tables and pressed CTRL + 3 to see top 10 records. SQL server has executed select top 10 * from sys.tables using a custom keyboard shortcut.

Custom Keyboard Shortcut In SQL Server_1

Also selecting a system stored procedure name from the query window and press CTRL + 4 (custom keyboard shortcut). We can see that SQL server has executed sp_helptext sp_tables using the keyboard shortcut and the source code is displayed.

Custom Keyboard Shortcut In SQL Server_3

Reference

Another post will guide you to use default keboard shortcuts in SQL Server. This Tech-Recipe shows handful of keyboard shortcuts to speed-up your work. 11 Keyboard Shortcuts Every SQL Server Geek Should Know

Summary

In this tech-recipes post you have learned to add a custom keyboard shortcut in SSMS. This will definitely boost your productivity by aligning few queries to shortcuts. If you like this post we recommend you to explore Tech-Recipes Database archives post to learn more useful stuff.

 

About Vishwanath Dalvi

Vishwanath Dalvi is a gifted engineer and tech enthusiast. He enjoys music, magic, movies, and gaming. When not hacking around or supporting the open source community, he is trying to overcome his phobia of dogs.
View more articles by Vishwanath Dalvi

The Conversation

Follow the reactions below and share your own thoughts.

Leave a Reply