It doesn't seem that long ago that having cool little tidbits of information about SQL Server made a huge difference in how effective you could be. Well, that's still true, but let me give you an example.
SELECT name FROM sysobjects WHERE sysstat & 4 > 0
In the early days of SQL Server, this was the way to pull a list of the names of all the stored procedures in your database. The 4 bit in the sysstat column represented stored procedures. (1 represented user tables and 2 represented view, as I recall, so changing the WHERE clause to read WHERE sysstat & 7 > 0 returned all tables, views and stored procedures.)
As SQL Server has evolved, Microsoft has made it easier to query the metadata to determine what objects existed, adding columns that helped (like 'Type' in this case), catalog views, Dynamic Management Objects, etc.
So, the challenge for this month's T-SQL Tuesday is: What T-SQL tricks do you use today to make your job easier? (Notice I didn't say PowerShell - I have a bunch of those now, but this is T-SQL Tuesday, not PowerShell Tuesday.)
Here are the rules:
- Your post must go live between 00:00:00 GMT on Tuesday December 13 and 00:00:00 GMT on Wednesday December 14.
- Your post must link back to this post, and the link must be anchored from the logo (found above) which must also appear at the top of your post.
- Leave a comment or a trackback here on this blog regarding your post.
- 'T-SQL Tuesday #025' should be included in the title of the post.
- If you're on Twitter, tweet about your post using the hash tag #TSQL2sDay
I'm looking forward to reading what goodies you're all going to share. After the event closes I'll post a summary of all your contributions.
Allen