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