You can create shortcuts for frequently used queries in Management Studio, some of the shortcuts are predefined, like pressing "Ctrl + 1" will execute "sp_who". You can create shortcuts for your own queries or change the existing shortcuts. To create a new shortcut, go to Tools > Options > Environment > Keyboard in Management Studio. For example, you can create a shortcut for:
SELECT COUNT(*) FROM AdventureWorks2008R2.Person.Address
Before you can use the shortcut you will need to restart Management Studio. To use this shortcut: 1. Restart Management Studio/Login to an instance, 2. Press "Ctrl + 3" (or the key you have assigned in your environment) 3. It will run the specified query and return the results.
For example, create a shortcut for:
SELECT COUNT(*)
To use this shortcut: 1. Restart Management Studio/Login to an instance, 2. Type fully qualified name of a table/view, e.g. Database.Schema.Table, (if you are in proper context you can also user Schema.Table or Table) 3. Highlight the name and press "Ctrl + 3" (or the key you have assigned in your environment) 4. It will run the specified query and return the results.
Richard Mueller edited Revision 3. Comment: Changed tags "SQL 2005", "SQL 2008", "SQL 2008 R2" to "SQL Server 2005", "SQL Server 2008", and "SQL Server 2008 R2", removed tag "SQL"
Maheshkumar S Tiwari edited Revision 1. Comment: Added tags