System views, twitter, and tshirts

First, a bit of TSQL.  I made a video yesterday but I'm too impatient for the video to be published, so here's the quick read: There are a few system views and sps I use on a daily basis. For starters, I easily forget the names of my SPs very often, so I have a simple way to  look them up:

SELECT [name] FROM sys.objects WHERE [name] LIKE '%get%' AND [type] = 'p'   — Use 'u' for user table

Similarly, I often remember that I wrote a piece of code (or used a particular call, or what have you), but can't remember in what procedure.

SELECT OBJECT_NAME(object_id) FROM sys.sql_modules WHERE [definition] LIKE '%@WhereIsMyDog%'

Though if I'm going to be completely truthful with you, I'm having to train myself off of using the soon-to-be-outmoded syscomments view.  I also like to get the full text of a stored procedure without digging though object explorer:

sp_helptext SPName

I have sp_helptext programmed in as the shortcut CTRL-F1 in SSMS, on ever box that I own.  And finally, you can use sp_depends (programmed as CTRL-3 on my box) to see the dependencies for an object. For example, this will display what tables and SPs the stored procedure "Get_All" references:

sp_depends Get_All

Twitter

It just occurred to me that we don't mention it much in our blogs, but there's a lively bunch of SQL folk in Twitter.  Oh sure, there are news and science feeds and celebrities, but you can just consider the SQL folks the "in crowd" 🙂  We post blogs, events, questions, answers, jokes, links, and whatever else comes to mind.  If you're new to Twitter and have no idea what it's about, no big deal. Sign up, check out the FAQ, go find and follow us (@MidnightDBA), and see where it goes from there.  A bunch of the SQL Server MVPs are on, and you can search for them by name or handle, or just wait for them to come up in someone else's tweets.

-Jen McCown, http://www.MidnightDBA.com