{"id":1593,"date":"2018-05-19T05:37:34","date_gmt":"2018-05-19T05:37:34","guid":{"rendered":"http:\/\/www.theSQLReport.com\/?p=1593"},"modified":"2018-05-19T05:40:00","modified_gmt":"2018-05-19T05:40:00","slug":"using-keyboard-query-shortcuts-in-sql-server-management-studio","status":"publish","type":"post","link":"https:\/\/www.theSQLReport.com\/?p=1593","title":{"rendered":"Using Keyboard Query Shortcuts in SQL Server Management Studio"},"content":{"rendered":"<p>This is something that I wish I had discovered years ago.\u00a0 I have put together my nine most used queries, functions, or system stored procedures that I use most everyday.<\/p>\n<p>The configuration of the keyboard query shortcuts are buried with in the SSMS.\u00a0 To get to the correct dialog box, click on the Tools drop down menu and then click on the Options menu item.<\/p>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2018\/04\/ToolsOptions.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1596 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2018\/04\/ToolsOptions.jpg\" alt=\"Tools Options\" width=\"650\" height=\"381\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2018\/04\/ToolsOptions.jpg 650w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2018\/04\/ToolsOptions-300x176.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2018\/04\/ToolsOptions-210x123.jpg 210w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/a><\/p>\n<p>In the left panel, navigate under the Environment to the Keyboard and click on Query Shortcuts in the Options dialog box.<\/p>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2018\/04\/DefaultQueryShortcuts.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1595 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2018\/04\/DefaultQueryShortcuts.jpg\" alt=\"DefaultQueryShortcuts\" width=\"759\" height=\"443\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2018\/04\/DefaultQueryShortcuts.jpg 759w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2018\/04\/DefaultQueryShortcuts-300x175.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2018\/04\/DefaultQueryShortcuts-210x123.jpg 210w\" sizes=\"(max-width: 759px) 100vw, 759px\" \/><\/a><\/p>\n<p>Displayed are the three defaults that can not be changed.\u00a0 Wish they could because I would replace sp_who with sp_who2.<\/p>\n<p>My recommendations for DBAs (developers would want different queries, functions, or system stored procedures):<\/p>\n<pre>Alt+F1\u00a0\u00a0 \u00a0sp_help (default)\r\nCtrl+F1\u00a0\u00a0 sp_helpfile\r\nCtrl+1\u00a0\u00a0 \u00a0sp_who (default)\r\nCtrl+2\u00a0\u00a0 \u00a0sp_lock (default)\r\nCtrl+3\u00a0\u00a0 \u00a0sp_who2\r\nCtrl+4\u00a0\u00a0 \u00a0select @@version\r\nCtrl+5\u00a0\u00a0 \u00a0select @@servername\r\nCtrl+6\u00a0\u00a0 \u00a0sp_spaceused\r\nCtrl+7\u00a0\u00a0 \u00a0dbcc sqlperf(logspace)\r\nCtrl+8\u00a0\u00a0 \u00a0xp_fixeddrives\r\nCtrl+9\u00a0\u00a0 \u00a0xp_readerrorlog 1\r\nCtrl+0\u00a0\u00a0 \u00a0xp_readerrorlog<\/pre>\n<p>Below is what the Options dialog box looks like in my SSMS:<\/p>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2018\/04\/DBAQueryShortcuts.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1598 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2018\/04\/DBAQueryShortcuts.jpg\" alt=\"DBAQueryShortcuts\" width=\"855\" height=\"516\" \/><\/a><\/p>\n<p>When using the keyboard query shortcuts, the shortcuts being used does not appear in the query window.\u00a0 The results return just the lower panel.\u00a0 The example pictured below is of the sp_who2 stored procedure results.<\/p>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2018\/04\/RunQueryShortcuts.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1600 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2018\/04\/RunQueryShortcuts.jpg\" alt=\"RunQueryShortcuts\" width=\"654\" height=\"312\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2018\/04\/RunQueryShortcuts.jpg 654w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2018\/04\/RunQueryShortcuts-300x143.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2018\/04\/RunQueryShortcuts-210x100.jpg 210w\" sizes=\"(max-width: 654px) 100vw, 654px\" \/><\/a><\/p>\n<p>Using a stored procedure that can accept a parameter like sp_help.\u00a0 Highlight the parameter then click on the Alt + F1 keys to run the sp_help stored procedure.<\/p>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2018\/04\/sp_help.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1602\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2018\/04\/sp_help.jpg\" alt=\"sp_help\" width=\"648\" height=\"330\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2018\/04\/sp_help.jpg 542w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2018\/04\/sp_help-300x153.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2018\/04\/sp_help-210x107.jpg 210w\" sizes=\"(max-width: 648px) 100vw, 648px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is something that I wish I had discovered years ago.\u00a0 I have put together my nine most used queries, functions, or system stored procedures that I use most everyday. &hellip; <a class=\"readmore\" href=\"https:\/\/www.theSQLReport.com\/?p=1593\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":1598,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[130,81],"class_list":["post-1593","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sql-server","tag-query-shortcuts","tag-ssms"],"_links":{"self":[{"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/1593"}],"collection":[{"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1593"}],"version-history":[{"count":8,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/1593\/revisions"}],"predecessor-version":[{"id":1608,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/1593\/revisions\/1608"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/media\/1598"}],"wp:attachment":[{"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1593"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1593"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1593"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}