THE SQL Server Blog Spot on the Web

Welcome to - The SQL Server blog spot on the web Sign in | |
in Search

Allen White

T-SQL Tuesday #025 - Invitation to Share Your Tricks

T-SQL TuesdayIt 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:

  1. Your post must go live between 00:00:00 GMT on Tuesday December 13 and 00:00:00 GMT on Wednesday December 14.
  2. 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.
  3. Leave a comment or a trackback here on this blog regarding your post.
  4. 'T-SQL Tuesday #025' should be included in the title of the post.
  5. 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.


Published Monday, December 5, 2011 10:52 AM by AllenMWhite
Filed under:



Rob Farley said:

T-SQL Tuesday again and this month is on T-SQL Tips (thanks Allen !). In some ways it’s a tough topic,

December 12, 2011 7:46 PM

Greg M Lucas said:

Here's my contribution - thanks for hosting Allen.

December 12, 2011 7:54 PM

Tracy McKibben (RealSQLGuy) said:

December 12, 2011 9:02 PM

Mala said:

December 12, 2011 9:40 PM

Chris Shaw said:

I think I am a little sooner than I should be, but got to work a double in 5 hours and I need to head to bed.  Great topic.  Thanks for hosting.

December 13, 2011 1:25 AM

Kent Chenery said:

Not sure this is a "trick"...but here's potentially a new idea for some people.  I've called it selective aggregates:

December 13, 2011 4:08 AM

Jason Strate said:

December 13, 2011 8:29 AM

Jes Schultz Borland said:

Thank you for hosting Allen! My contribution is "T-SQL Tuesday #25: T-SQL Tricks - Checking Transaction Log Space Used" -

December 13, 2011 8:30 AM

Colleen Morrow said:

December 13, 2011 10:29 AM

Nic Cain said:

December 13, 2011 12:06 PM

Steve said:

December 13, 2011 12:14 PM

Aaron Bertrand said:

This month's T-SQL Tuesday is being hosted by Allen White ( @SQLRunr ) and is about sharing your T-SQL

December 13, 2011 1:54 PM

Rob Volk said:

December 13, 2011 2:28 PM

Mark Broadbent said:

December 13, 2011 5:02 PM

Steve Smith said:

December 13, 2011 5:39 PM

Nigel Sammy said:

December 13, 2011 11:02 PM

Steve Jones said:

Weird, i before e except after c. Mine didn't appear. Here it is:

December 14, 2011 12:00 PM

Rob Farley said:

In my last post, I showed a technique for dealing with working columns when writing T-SQL. The idea was

January 9, 2012 7:06 PM
New Comments to this post are disabled

About AllenMWhite

Allen White is a consultant and mentor for Upsearch Technology Services in Northeast Ohio. He has worked as a Database Administrator, Architect and Developer for over 30 years, supporting both the Sybase and Microsoft SQL Server platforms over that period.

This Blog


Privacy Statement