July 14, 2011 | SQL Server

SQL Server v.Next (Denali) : Getting Ctrl+R to work again

Ctrl+R is a good friend of mine – we go way back. It is very handy to use this command not only to hide the results pane away and focus on the query at hand, but to also be able to bring the results back just as quickly – without having to run the query again, or mess with click + drag nonsense.

In Denali, we get a new version of SSMS, tightly integrated into the Visual Studio shell. With that we get some great benefits (and I've talked about them before). In that post I also point out some of the problems – they've fixed the double-click on an error message bug, for example, but they haven't fixed some other things, such as Ctrl+U = lower case, instead of the more logical Ctrl+Shift+L (to match Ctrl+Shift+U for upper case).

The one that really got my goat yesterday is that Ctrl+R has been assigned to some other function. On a freshly-minted virtual machine, with a brand new install of Windows 7 (including 88 items from Windows Update), I laid down a clean install of Denali (very simple – just engine, BIDS, BOL and management tools – no Juneau, Visual Studio, Analysis Services or other BI features, etc etc). On the first launch of SSMS (where I am supposed to be asked for my keyboard preferences, but no prompt appeared), I opened a new query window, typed "SELECT 1;", and hit F5. I received a results pane with (No column name) / 1. Exactly as I expected. Then the trouble begins. I hit Ctrl+R; nothing happens. I wonder if I pressed the wrong letter, didn't fully press Ctrl, or what, so I press it again. My computer beeps at me like I was trying to double-click on the A: drive in Windows Explorer.

As a true sign of my insanity, I keep trying – expecting a different outcome with the same input. Then I notice the status bar changing as I fruitlessly try to make the results pane go away. On first press of Ctrl+R, I see this in the bottom left corner:

 

And when I press it again, along with the beep, the status bar changes to this:

 

Okay, so now we're onto something – it seems this change was intentional. So off I go to Tools / Options / Keyboard / General to see what's what. In the middle box, select Window.ShowresultsPane, change the "Use new shortcut in:" dropdown to SQL Query Editor (Global did not work for me), put your cursor in the "Press shortcut keys:" box and hit CTRL + R. You should see the following:

 

So I'm not sure what this Edit.SwapAnchor command is supposed to be, or why I give a rip about some DataWarehouse Designer – as I thought I had voted, simply by my installation choices, that I'm not crazy into BI. I'm sure this command is important to someone, and for them, the default will work just fine. For the other 99.99% of Management Studio users, you can fix this now by clicking Assign and then OK. Unlike some other changes that still require an SSMS restart to take effect (e.g. experimenting with font choices in grid results can be fun), the change takes effect immediately.

If you want to fix many of these keyboard shortcuts in one swoop, see this post from Denny Cherry (@mrdenny), where he provides a settings file you can import easily (just be aware that not all of his customizations match the original 2008 R2 settings exactly):

http://itknowledgeexchange.techtarget.com/sql-server/resetting-ssms-shortcut-keys-in-sql-server-denali-ctp-3/

I am hoping that the RCs or, at the very least, the RTM versions, show a keyboard scheme that says "SQL Server settings" instead of a generic "default." And that this default does not include Ctrl+R being assigned to a DataWarehouse Designer operation unless I say I want it that way.

EDIT
Microsoft has published the official instructions for resetting the keyboard, should you find yourself in this situation, and there is in fact a SQL Server mode (the choices in Tools/Options, "default" and "Visual Studio 2010 Compatible" are not that obvious – again, I'm hoping this gets changed to match the reset dialog). See the following blog post for more info:

http://blogs.msdn.com/b/sqlrem/archive/2011/07/13/enhanced-keyboard-shortcuts-in-ssms-in-denali.aspx

 

51 comments on this post

    • Pierre Cardona - July 14, 2011, 8:41 PM

      Thank you, thank you, thank you.

    • Pierre Cardona - July 14, 2011, 9:18 PM

      Have you had any problems in SSMS with the "Open File" or "Save File As" dialog boxes not showing mapped network drives?  I'm seeing this on an x64 installation on a Windows Server 2008 R2 host.  All other apps I've tried on the server can see mapped network drives.  An x86 installation on another host does not have this issue.

    • AaronBertrand - July 14, 2011, 9:43 PM

      No, mapped drives work just fine for me. Silly question but have to ask, are you running as administrator?

    • AaronBertrand - July 14, 2011, 9:48 PM

      Let me rephrase, do you notice a different behavior if you right-click the SSMS shortcut and choose "Run as administrator"? Do you have UAC enabled?

    • Pierre Cardona - July 14, 2011, 10:02 PM

      I'm logging onto Windows as an Administrator and am also running SSMS as an Administrator; it shows (Administrator) in the title bar of SSMS while running.  I can drill down into "Network" to find the resources I want, but mapped network drives aren't shown with other drive letters in the "Computer" node of the tree.  The open and save as dialogs in other apps, such as BIDS, Notepad and Internet Explorer, do not have the same issue.  I'll keep playing with it and share any interesting news.

    • AaronBertrand - July 14, 2011, 10:11 PM

      I definitely see mapped drives under Computer:
      http://bertrandaaron.files.wordpress.com/2011/07/ssms_mapped.png
      However I am using VMWare Fusion and so there might be different network behaviors at play. Have you run any tools to determine whether SSMS tries to get out to those mapped drives?
      Also there might be something here – I remember Paul Randal battling with a performance issue that seems related, is it possible you have mapped drives that are not showing up because they're very slow or offline?
      http://www.sqlskills.com/BLOGS/PAUL/post/Ever-had-poor-performance-saving-files-in-SSMS-over-slow-network.aspx
      http://web.archive.org/web/*/http://web.archive.org/web/*/https://connect.microsoft.com/SQLServer/feedback/details/651176/ssms-tries-to-access-disconnected-network-drives-when-in-the-save-file-as-wizard
      http://web.archive.org/web/*/http://web.archive.org/web/*/https://connect.microsoft.com/VisualStudio/feedback/details/114463/slow-file-save-when-recent-files-projects-on-a-network-drive

    • Pierre Cardona - July 14, 2011, 10:31 PM

      As you suggested earlier, the issue appears to be related to UAC.  My initial setting was "Default".  When I changed it to "Never notify" and rebooted, mapped network drives were then visible in the SSMS open and save as dialog boxes.  For fun, I changed the setting back to "Default", rebooted, and the mapped drives then disappeared.  After that, I changed the UAC setting back to "Never notify", rebooted, and was able to see mapped network drives again in the SSMS open and save as dialog boxes.  I have not tried either of the other two UAC settings to see what impact they would have.
      Thanks for your continuing community support.

    • Balaji - August 5, 2011, 8:04 AM

      Thank you Aaron, I have been wondering for sometime, how to get back my Ctrl+E and Ctrl+R for the obvious choice that I am used to since long:)

    • Jeetendra - September 15, 2011, 9:10 AM

      Thank you..

    • Finn - December 14, 2011, 1:45 AM

      Thank you. Save me time to find.

    • Arthur - March 12, 2012, 6:38 PM

      The functionality is not present in the SSIS 2012 RTM build, too.
      Yet, reportedly, the workaround does not work in it.
      I have a MS Connect item asking to fix that at http://bit.ly/xaF3Jf.
      Hopefully it gets enough votes to be resolved in SP1 of SQL Server 2012.

    • BJReplay - April 1, 2012, 9:07 AM

      Your blog post combined with my google-fu restored my CTRL+R goodness.

    • Tracy McKibben (RealSQLGuy) - April 11, 2012, 6:08 PM

      Thank you, thank you, thank you.  This was driving me nuts…

    • Jens Frandsen - April 12, 2012, 11:15 PM

      Thanks!! Never heard of Denali, but this functionality in MSSQL 2012 stopped working as it did in 2008/2005/2000/7 and I'm of the group that use CTRL+R regularly and glad to have it back.
      Thanks again.

    • Greg - August 2, 2012, 9:16 PM

      Thanks dude!

    • Brian Perrin - August 17, 2012, 1:48 AM

      Hey, thanks for the post.  Question: do you know how to assign a proc to the "Query.CustomSP1", SP2, etc commands?  thx

    • Grant - August 27, 2012, 6:21 PM

      Thank you!  Holy Crap that was killing me!
      Why in the hell would they turn that off?!
      Grant

    • Satya - September 6, 2012, 10:19 PM

      This helped and relieved my pain 🙂

    • Derek Dieter - September 26, 2012, 9:24 PM

      Thank you!!!

    • Rasmus Goth Engel - December 8, 2012, 10:00 PM

      Thank you for reuniting me with my friend ctrl R

    • Abrar Ahmad - December 20, 2012, 9:27 AM

      yep, but if anyone can solve the following issue
      that how we can make custom commands and assign them the new shortcuts? Especially how to map "query.customsp?" short cuts :S
      thank you!

    • Andrew - January 30, 2013, 5:38 PM

      The window was open and i was just about to unplug the PC and throw it out when i found your blog post.
      Thanks!

    • Deepa - February 13, 2013, 11:26 AM

      Good Article. Thank you

    • Abhilash - March 19, 2013, 7:02 PM

      It is nice article with simple steps and images to understand easily.

    • boda76 - April 11, 2013, 6:46 PM

      It works! thanx!

    • Chalapathi Pinisetty - May 9, 2013, 4:22 AM

      It's working.. saved my time.. Thank you..

    • Bhau - May 27, 2013, 4:45 PM

      Thanks a lot

    • xprt - June 3, 2013, 9:29 AM

      Thanks a lot for the help. Great

    • Bolton Winpenny - July 3, 2013, 12:54 PM

      ARG! First and foremost, thank you for the solution…BUT,  as frustrating it is to hit the problem, a post like this is just as  frustrating.  Can't you just say in the first sentence, "To resolve…" I've done my usual quick pass through your text and didn't find the solution.  I've done a 2nd pass, and I suspect the answers in there somewhere. Now I have to go through and read every thought you've had over the past 3 months to figure out where in there is the solution.

    • Bolton Winpenny - July 3, 2013, 1:01 PM

      ARG! First and foremost, thank you for the solution…BUT,  as frustrating it is to hit the problem, a post like this is just as  frustrating.  Can't you just say in the first sentence, "To resolve…" I've done my usual quick pass through your text and didn't find the solution.  I've done a 2nd pass, and I suspect the answers in there somewhere. Now I have to go through and read every thought you've had over the past 3 months to figure out where in there is the solution.

    • Bolton Winpenny - July 3, 2013, 1:21 PM

      ARG!  Boy do I sound like a bitch, but…. this didn't work for me!  I see per above and in other postings that this work around doesn't work for VS SQL Server Managment Studio 2012.

    • AaronBertrand - July 3, 2013, 4:45 PM

      Bolton, wow, I'm very sorry my writing style is unsatisfactory to you and that you must be sarcastic about how painful it is for you to read it.
      As far as it not working, you'll notice that the post was written LONG before the final version of SQL Server 2012 was released. Let me contact accounting to see what we can do about a refund. 🙂

    • Alejandro - July 4, 2013, 8:46 PM

      thanks very much
      muchas gracias

    • m - July 6, 2013, 12:22 AM

      m

    • Anna - July 6, 2013, 12:22 AM

      Excelent!!

    • Jonas Bergström - July 26, 2013, 4:41 PM

      Thank you Aaron! I was following the same path as you described, and since I change between different computers and servers didn't realize until today that it was a SSMS change, but still I didn't know what to do with that information "The key combination (Ctrl+R, Ctrl+R) is not a command." that showed up in status bar. Great work there finding what to do about it.

    • Amit Dhamija - July 30, 2013, 8:05 AM

      Thanks a Lot.. Its gr8

    • Martyn - August 15, 2013, 12:48 PM

      Just wanted to say thanks – thanks!

    • Avi - September 10, 2013, 2:24 PM

      Thank You!!

    • Beena Paneliya - September 28, 2013, 10:15 AM

      Thanx its working…..

    • Ramakrishna - October 1, 2013, 3:18 PM

      The info provide is worthwhile. Thanks a Milliion.

    • Harry Kermet - October 16, 2013, 11:37 AM

      If only I had a bag of flawless diamonds, I'd pour them all over your hands! THANK YOU SO MUCH!!!!!!!!!

    • ManojPandey - November 8, 2013, 7:49 AM

      There is no problem when I open SSMS, but when I used to open SSMS as a different user the Ctrl+R combination didn't used to work.
      Now after going by the steps you provided it is working perfectly.
      Thanks!
      SQLwithManoj.wordpress.com

    • Avishek - February 27, 2014, 10:05 AM

      Thanks. This was very helpful.

    • Otto - April 8, 2014, 1:46 PM

      Thanks a million

    • Ender - June 11, 2014, 4:11 PM

      Thanks!!! Very usefull article!

    • Naresh - July 14, 2014, 4:44 PM

      Thanks!! very very usefull article..it's working for me

    • Paul - July 15, 2014, 2:06 AM

      Thanks so much. I also missed that short-cut dearly and I'm so happy to have it back. 🙂

    • SQLNoob - September 10, 2014, 9:03 AM

      WTH! I was so frustrated too! Anyway, Thanks. Should have consulted google immediately.

    • Vanessa - January 8, 2015, 12:17 PM

      Great thanks for the article and links.

    • Denis - May 31, 2016, 11:12 AM

      Great thanks!

Comments are closed.