The Art of SQL Server Database Administration, Development, and Career Skills for the Technically Minded
Day 3. Yesterday was all about reducing key strokes. Today is about maximizing your viewing area. There are some really trick things you can do within SSMS to enhance your query experience. One of the coolest was one shared by Kendra Little a few months ago.
I hinted at this feature in my day one post when setting up custom hotkeys. The query window splitter. Just grab the little icon in the upper right hand corner of the query window and drag down. You can also turn it on clicking Window->Split on your menu. Super helpful when working with a huge query. This isn’t a copy, it’s the very same query – just two different views – editing one edits the other.
I like this feature so much that I turned it into a hotkey (Alt+S) on day one while demonstrating setting up custom hotkeys in Options->Environment->Keyboard.
See animation below. (you may need to enable animations under internet options in IE)
Pinning Multiple Tabs:
While the query splitter creates two windows of the same query – you can view two different tabs at once as well. You accomplish this by dragging a tab away from the tab area. You’ll be given options of where you’d like to pin it in the form of a floating window map. (again image below is a gif animation – enable animations on IE)
Pinning and Placing other Windows:
You can use this same technique to move any of the other windows around as well – such as the object explorer, registered servers, properties, results pane.
You can also set them to auto-hide by clicking the little push pin icon up in the corner and give yourself a lot of room on your workbench.
Most people don’t use these much, and I’m not sure why. If you have a ton of scripts your working with, setting up a few bookmarks is a great way to save time. You bring up the bookmark window either by selecting it under View->Bookmark Window menu item or hitting Ctrl-K and then Ctrl-W.
You set bookmarks by hitting Ctrl-K and then Ctrl-K again.
Ctrl-K is an interesting hotkey. It is kind of like a function key on laptops in that after you hit Ctrl-K SSMS wants another key to complete the command chord. You’ll end up finding lots of useful hotkeys that require you to hit Ctrl+K first, and then the specific hotkey second. Ctrl+K and then Ctrl+C for commenting out blocks of code for example. I remember Ctrl+K by calling it the Ctrl+K(eyboard) command. I don’t think that’s the official name though I’ve never heard a better one. Microsoft usually just calls it the first key in the chord which usually get’s a response like… WTH?? from the new SSMS/VS user.
Once you have a bunch of bookmarks set all you need to do is double click the bookmark in the bookmark window and bam – there you are. Even if the query isn’t currently open.
See ya tomorrow, we’ll take querying up another notch.