Hi Friends,

Reading Amit Bansal’s tips on SQL Server Management Studio, I also remembered the old days when we used to do such small tweaking to automate some of the tasks in SSMS. I would also like to share here one tip which enables us to maintain shortcuts for certain commands which we use most of the time and hence saves a little typing time.

There is a provision to define certain shortcut keys in SSMS. Press Alt+F1 in an empty query window and you will get the entire object list inside a database (sp_help). Pressing Ctrl+1 executes sp_who command which Provides information about current users, sessions, and processes in an instance of the Microsoft SQL Server Database Engine. So can we customize this to add our own shortcuts to execute commands which we use most of the time? Let’s see how…

In SSMS, Click on the Tools menu and select Options.

1_SQL_Server_Management_Studio_Tip_Keyboard_Shortcuts_in_SSMS

In the options window, expand Environment and select Keyboard. Here you can configure the query shortcuts and assign them to particular keys. Observe that Alt+F1, Ctrl+1 AND Ctrl+2 are assigned by default to sp_help, sp_who and sp_lock respectively and can not be changed. We can use the other keys to customize our own shortcuts. In this example, I have set the following,

2_SQL_Server_Management_Studio_Tip_Keyboard_Shortcuts_in_SSMS

Ctrl+F1 – select * from sys.tables order by name

Ctrl+3 – select getdate()

This setting will take effect only for the new query window and not the query windows already opened. Open a new query window in AdventureWorks database and press Ctrl+F1. You will get the list of all the tables in this database. Press Ctrl+3 and you can see the system date and time.

3_SQL_Server_Management_Studio_Tip_Keyboard_Shortcuts_in_SSMS

Try IT :)

 

Regards

Amit Karkhanis

Like us on FaceBook Follow us on Twitter

Join the fastest growing SQL Server group on FaceBook