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

 

Aaron Bertrand

I am a passionate technologist with industry experience dating back to Classic ASP and SQL Server 6.5. I am a long-time Microsoft MVP, write at SQLPerformance and MSSQLTips, and have had the honor of speaking at more conferences than I can remember. In non-tech life, I am a father of two, a huge hockey and football fan, and my pronouns are he/him. If I've helped you out, consider thanking me with a coffee. :-)

51 Responses

  1. Denis says:

    Great thanks!

  2. Vanessa says:

    Great thanks for the article and links.

  3. SQLNoob says:

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

  4. Paul says:

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

  5. Naresh says:

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

  6. Ender says:

    Thanks!!! Very usefull article!

  7. Otto says:

    Thanks a million

  8. Avishek says:

    Thanks. This was very helpful.

  9. ManojPandey says:

    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

  10. Harry Kermet says:

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

  11. Ramakrishna says:

    The info provide is worthwhile. Thanks a Milliion.

  12. Beena Paneliya says:

    Thanx its working…..

  13. Avi says:

    Thank You!!

  14. Martyn says:

    Just wanted to say thanks – thanks!

  15. Amit Dhamija says:

    Thanks a Lot.. Its gr8

  16. Jonas Bergström says:

    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.

  17. Anna says:

    Excelent!!

  18. Alejandro says:

    thanks very much
    muchas gracias

  19. AaronBertrand says:

    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. 🙂

  20. Bolton Winpenny says:

    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.

  21. Bolton Winpenny says:

    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.

  22. Bolton Winpenny says:

    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.

  23. xprt says:

    Thanks a lot for the help. Great

  24. Bhau says:

    Thanks a lot

  25. Chalapathi Pinisetty says:

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

  26. boda76 says:

    It works! thanx!

  27. Abhilash says:

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

  28. Deepa says:

    Good Article. Thank you

  29. Andrew says:

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

  30. Abrar Ahmad says:

    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!

  31. Rasmus Goth Engel says:

    Thank you for reuniting me with my friend ctrl R

  32. Derek Dieter says:

    Thank you!!!

  33. Satya says:

    This helped and relieved my pain 🙂

  34. Grant says:

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

  35. Brian Perrin says:

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

  36. Greg says:

    Thanks dude!

  37. Jens Frandsen says:

    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.

  38. Tracy McKibben (RealSQLGuy) says:

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

  39. BJReplay says:

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

  40. Arthur says:

    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.

  41. Finn says:

    Thank you. Save me time to find.

  42. Jeetendra says:

    Thank you..

  43. Balaji says:

    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:)

  44. Pierre Cardona says:

    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.

  45. AaronBertrand says:

    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

  46. Pierre Cardona says:

    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.

  47. AaronBertrand says:

    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?

  48. AaronBertrand says:

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

  49. Pierre Cardona says:

    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.

  50. Pierre Cardona says:

    Thank you, thank you, thank you.