Although an image of Shrek is currently my @DataOgre avatar, I’m no Shrek expert. But, I do remember parts of it, and the scene where Shrek says that ‘ogres are like onions’ was one of my favorites. SSMS Tools Pack has been like an onion for me in the past week, and I’ll describe three of the layers that stood out for me. Dave Valentine ( blog | twitter ) and I already cover two of these in our Freaky Fast Database Development Tips session. If you haven’t seen it yet, come check us out at SQLSaturday 149 in Minnesota.
Window Connection Coloring
Last Tuesday evening I saw that David Klee ( blog | twitter ) tweeted about a blog post describing how to use SQL Server Management Studio’s built in feature that allows you to customize the color of the Status Bar at the bottom of a Query window. I replied that SSMS Tools Pack does that and more. SSMS’ built in feature doesn’t do it for me, because my attention seems to usually be at the top of the window, not the bottom. Here’s how to set that up with SSMS Tools Pack, from the SSMS menu:
SSMS Tools > Window Connection Coloring > Optons…
Notice that you can check IsRegex to use a regular expression that applies across many servers (eg, looking for a common pattern like PROD). You can also decide how thick the color strip is, and where it is docked. Both Top and Left grab my attention. Here’s an example of what it can do for you.
I can think of two instances where SQL Snippets are handy:
You know exactly what you want to type, and would like your text to be autocompleted.
You need a template because a certain syntax just doesn’t stick in your head. Maybe you use it infrequently, or maybe the syntax is just awkward.
We have covered SQL Snippets in the Freaky Fast presentation, but have never showed how to create a new snippet. I rarely use SELECT INTO, but recently needed to do a quick and dirty backup of some tables, and thought it would be perfect for my first custom SQL Snippet. Here’s how I created it, from the SSMS Menu:
SSMS Tools > SQL Snippets > Options…
On the left side, in the table that has a column header for Shortcut, scroll to the bottom and enter the shortcut keys that you want for your new snippet (in this case, I used SI for SELECT INTO).
If the table jumps around on you, just scroll to where the new row you created should be, and enter your Snippet Text.
Now, whenever you are in a query window, type SI and press Enter and SI will be replaced with the Snippet Text that you entered.
Search Grid Results
So, my big find this week was Search Grid Results. I was verifying my fix for a bug in a stored procedure and was looking for a specific id. I could think of several ways of doing this, but I was sure that one of the tools we highlight in Freaky Fast could search the grid results. Sure enough, I right clicked in the Grid Results, and saw Search Grid Results in my context menu. Worked like a charm!