SQL Server Management Studio (SSMS) Keyboard Shortcuts


Every day we are getting similar task , Like , health check , Backup Restore status and  many of them and what we do, we save all query is some text file or individual files and copy paste when ever we need.

But did we forget SSSM gives us a way to use these queries with shortcut. I use below shortcut for same

Alt + F1: sp_help
Ctrl + F1: Select @@SERVERNAME
Ctrl + 1: Sp_who
Ctrl + 2: sp_lock
Ctrl + 3: sp_who2 Active
Ctrl + 4: xp_readerrorlog
Ctrl + 5 : Declare @S_date datetime , @E_date datetime ;Select @E_date = getdate() ,  @S_date = @E_date -1 ;Exec xp_readerrorlog 0,1,null,null, @S_date , @E_date
Ctrl + 6: select * from master..sysprocesses where blocked <> 0
Ctrl + 7: Exec sp_msforeachdb 'use [?] dbcc opentran'
Ctrl + 8: dbcc sqlperf(logspace)
Ctrl + 9: exec msdb..sp_help_job @execution_status = 1
Ctrl + 0 : Select @@servername as Instance,ServerProperty('ServerName') as ServerName,            ServerProperty('ComputerNamePhysicalNetBIOS') as PhysicalHost,ServerProperty('Edition') as Edition,ServerProperty('InstanceName') as InstanceName,ServerProperty('MachineName') as MachineName,ServerProperty('ProcessID') as [ProcessID_check from taskmanager],ServerProperty('ProductVersion') as ProductVersion,ServerProperty('ProductLevel') as ProductLevel,ServerProperty('ResourceLastUpdateDateTime') as ResourceLastUpdateDateTime,@@VERSION VersionInfo

So now how to do this

1. Open SSMS -->Tools --> Options --> Keyboard 
2. Once you saved your queries with shortcut , Close SSMS and re-start. Now Shortcuts are ready to use.

3. Please always use select or similar queries (which dont do any update/ insert/update/ backup / any operation).

Note: We can use separate settings for separate Windows NT logins. We have to just use run as for separate logins while connecting SSMS


There is a partial list of keyboard shortcuts provided by SQl server

Effect
ALT + N
New query window
CTRL + F4
Close current query window
CTRL + W
Highlight the word where the cursor is currently located
CTRL + Shift + U
Convert selected text to UPPER CASE
CTRL + Shift + L
Convert selected text to lower case
F5
Execute the selected query or if nothing is selected, then execute the entire content
CTRL + F5
Parse the selected query or if nothing is selected, then parse the entire content
CTRL + T
Results to Text
CTRL + D
Results to Grid
CTRL + SHIFT + F
Results to File
CTRL + R
Toggle display of results pane
F7
Display Object Explorer Details
CTRL + ALT + G
Display Registered Servers pane
CTRL + K, C
Comment Selection
CTRL + K, U
Uncomment Selection
CTRL + TAB
Cycle through open query windows and panes
F6 / SHIFT + F6
Cycle through the query text, resultsets and messages pane inside a query window
CTRL + J
Display Intellisense menu (Only in SSMS in SQL Server 2008 and later)
CTRL + ALT + L
Display Solution Explorer
CTRL + SHIFT + R
Refresh Intellisense cache
ALT + F1
Execute sp_help in the current results pane
CTRL + 1
Execute sp_who
CTRL + 2
Execute sp_lock
CTRL + U
To go to drop down list of Databases
CTRL + L
Display the Execution Plan


SQL Server Management Studio Keyboard Shortcuts List

Read Also :SQL Server Configuration Manager shortcut


6 comments: