Assign shortcuts To SQL Queries in SQL Server

Many times a developer has to repeatedly write a query several  times. This could often become irritating. SQL Server provides us a way in which we can assign shortcuts for queries in SQL Server. Let us use this feature of SQL Server and see how it benefits us.

Open SQL Server management Studio. Go to Tools->Options.

tools

Click on Query Shortcuts. Assign the query on the right side pane. The corresponding shortcut on the left side of the query would be the shortcut. Here I have assigned Select * from to Ctrl + 3 shortcut. Click OK.

options

Let us now move to query editor and see if it works. We will just mention the name of the table and see if we get the output. Select the table and press Ctrl + 3 on the keyword and you should get the records from the table.

country

We can assign more shortcuts as per our need. I hope this trick is useful to developers.