I Blog Because I Less Than Three You

Today's blog will be a bit gratuitous, but I feel we haven't talked in some time.

So Sean and I are in Seattle for the much-envied SQL Tweetup with Donald Farmer – that's this afternoon. We flew in a day early and spent yesterday at the mothership, Microsoft Redmond, for some awesome briefings on R2. I honestly wasn't paying much attention before, but am now officially really excited about the SQL 2008 R2 release.

Last night we had a lovely dinner with some very cool folk from Waggener Edstrom (our "handlers", ostensibly), plus Jorge Segarra (of @SQLChicken and SQL University fame).  Turns out he's just as cool as (but slightly taller than) you'd expect from hanging out on Twitter.  He and the hubby and I went to a late showing of Clash of the Titans, and now my life is complete.  I. Love. Clash oft he Titans.  SO cheesy, SO gratuitous, SO awesomesauce. Please note that you have to have loved the ultra-cheesey-campy original Clash movie, circa 1744…

Today we're sitting in Top Pot Donuts with @SQLChicken @SQLAndy, and @mrDenny having a jolly good time talking about PASS and SQL Saturdays. We'll film a DBAs at Midnight before lunch, and hop on the Tweetup shuttle this afternon. We're talking about it now, and honestly we're not entirely sure what this afternoon is about, exactly. I mean, it sounds awesome, and we're delighted to be here, but the purpose isn't really as clear cut as, say, the PASS Summit.

So stay tuned for upcoming tweets, blogs, and videos coming out of this great trip, and remember…we do all this for you, Constant Reader, because we <3 you.

Happy, happy days,
Jen McCown
http://www.MidnightDBA.com

Custom Keyboard Shortcuts in SSMS

Content rating: Beginner, Tip 

I KNOW I blogged about custom SSMS shortcuts before, but dang if I can find it.

I use certain commands SEVERAL times a day, and I’m in love with shortcuts. So the SMS keyboard shortcuts dialog is just perfect for me.  You already have three default shortcuts when you install SSMS:

  • Alt+F1 – sp_help
  • Ctrl+1 – sp_who
  • Ctrl+2 – sp_lock

So if you want info on your Region table, you’d type Region, highlight it, and hit Alt-F1. Go on, try it. Isn’t that awesome?

Well I also use sp_depends and sp_helptext a lot, so I have those set to Ctrl+3 and Ctrl+F1, respectively. To add a keyboard shortcut:

  1. Select Tools > Options > Environment > Keyboard
  2. Click an empty space next to the shortcut you want.
  3. Type or paste your command.
  4. Click OK. (Note that shortcut changes take effect in query windows you open after the change.)

Today I added a new one that I use a lot – I use this query to search for a word or phrase within all SQL programmable objects:

SELECT OBJECT_NAME(OBJECT_ID) nm
FROM sys.sql_modules
WHERE definition LIKE '%region=0%'

This gives me the names of all SPs, views, triggers, and functions with the EXACT phrase “region=0” in it.  It’s not foolproof, but it’s extremely useful. So finally today I added this to my shortcuts as Ctrl+0:

SELECT OBJECT_NAME(OBJECT_ID) nm
FROM sys.sql_modules
WHERE definition LIKE '%

Why didn’t I think of this before? Now all I have to do is type “region=0%'”, highlight it and push Ctrl-0.  I LOVE shortcuts.

Snippets

Many thanks to MladenPrajdic and SQLChicken for mentioning Snippets to me. With Redgate’s SQL Prompt (which I ADORE) or the SSMS Tools Pack kit (free, and which I also ADORE), you can set it up to autocomplete commands for you. To quote SQLChicken: “Snippets are a godsend. You can create one where you type wtf and press TAB and whatever command u want comes up.” Nice, very nice. Now if Only I could install SQLPrompt or the toolkit at work… 🙁

Happy days,

Jen McCown

http://www.MidnightDBA.com

SQL Server Musical Contest – Finalists

Edit: Winner announcement!!!

I'm not going to lie to you Marge: This is the most fun I've had on the internet in years.  I'm speaking, of course, about the SQL Server Musical Constest. I asked for some creativity, and you guys really ponied up. My absolute favorites, and therefore the finalists, are:

Annie Get Your Execution Plan (Annie Get Your Gun) – Tomboy Annie (played by Kimberley L. Tripp) can compose t-sql and generate perfect execution plans as easily as she can walk, making life difficult for Frank (played by Paul Randal). Their rendition of "Any Plan You Can Do, I Can Do Better" reached number one on the charts.

A StreetVARCHAR Named Desire – Blanche DuBois, an attractive southern belle (portrayed by Jessica M. Moss), is trying to design a streetcar operations database. Unfortunately Blanche isn't completely familiar with SQL datatypes, and creates all text fields as CHAR(255). She meets master DBA Stanley Kowalski (played by Marlon BrentO) who schools her in the ways of proper table design. In the final scene, Blanche admits that "I have always depended on the kindness of strangers."

ShowFLOAT – One of Oscar Hammerstein's lesser-known works about a young aspiring DBA trying update tables with numeric values greater than 10^38. Through the help of the Twitter community, he gets in touch with many experienced DBAs and learns that at the expense of precision, the FLOAT type will give him the range he needs.  Musical Numbers include: – Ol' Man Randal – Can't Help Lovin' Dat Merge

Ghost Cleanup of the Opera – Some little known process tries to process block some other dude because they like the same spid. Classic tale.

Wicked – While the world knows DBA's as cruel, maladjusted individuals this heartwarming story tells us how it REALLY is and how we're really misunderstood, loving, maladjusted individuals…with a taste for bacon. Guest performance by Buck Woody as he shows how he's "Defying Gravity" via massive consumption of caffeine.

Best Little DataWarehouse in Texas. Story about running a SQL datawarehouse with no official licensing. With Bucky Woody as Melvin Thorpe the meddling TV reporter and @BrentO playing the part Dolly Parton would later capture in the movie version (you know why).

Phantom Reads Of The Opera – A dramatic production focusing on Christine Daees, a young business analyst straight out of college, who struggles to get reports from SQL Server using her companies third party BI tools. Constant blocking issues plague her until a resourceful DBA comes to her aid adding nolock hints to all of her queries, getting her results quickly….only later does she realize that all her work is for naught as uncommitted data shows in all the reports presented to management. Christine becoming another victim to the Phantom Reads.  I think that a nice addition to the musical would be the inclusion of the classic Roxette hit "You've got the lock".

spidALOT: Join Sr. DBA Arthur, Brave Dev Robin, SQLAgentman The Enchanter (Some call him "TIM!"), fellow DBA Grantalot, and their brave Pages as they are sent on a quest by MANAGEMENT to find out why performance is so slow on their servers. Along the way they meet Engineers with HUGE TRACTS OF SAN, Monitoring Vendors attempting to distract them with sex, a Server Admin who calls himself "Teh Black Knight" who refuses to take any advice offered by the DBA, and a killer bunny owned by the nocturnal Mr. Denny.

LEFT JOIN Story – Set in New York City in the mid-1950s, the musical explores the rivalry between the Dweebs and the Dorks, two teenage DBA gangs of different RDBMS backgrounds. The members of the Dorks are huge proponents of natural keys and are taunted by the Dweebs, a group of MCDBAs who much prefer surrogates.

I realize I didn't include the author names; this is on purpose. I'm still deciding, so I want to be as impartial as I can and forget names. You can see ALL the submissions and who wrote them on the original thread.  Winner will be announced today, promise.

Edit: I lied, I'm announcing the winner tomorrow instead. But today is tomorrow, so….the winner is:

Tim Ford @sqlagentman, for spidALOT!!!

I couldn't help myself…I loved all the submissions, but this had the most effort, the most geek jokes, and the phrase "HUGE TRACTS OF SAN" which has made me laugh EVERY SINGLE TIME I READ IT! Great job, Tim! Thanks for playing guys…this was a lot of fun!

Happy days,
Jen McCown
http://www.MidnightDBA.com