Tag Archives: T-SQL

Tomato, Tomato – Assumptions about Regionalization

This month’s TSQL Tuesday prompt is on the topic of assumptions. I’d like to take a brief moment and talk about one of the more insidious and pervasive sources of bugs in TSQL application code I’ve seen over the years. Let’s say I present you with a date: 08/12/2014 Quick! What month am I talking about?  Read more »

July 8, 2014 Posted by: Leave a comment - Permalink

Killing Sessions with External Wait Types

This afternoon I was asked a question that comes up once or twice a year by email. I answered as usual, and only later realized that the topic was a reasonably good match for this month’s TSQL Tuesday topic. I thought I might share the question, and the answer, with a larger audience this time.  Read more »

December 11, 2013 Posted by: 4 Comments - Permalink

SQL Server bug: Incorrect values in sys.dm_db_session_space_usage for deferred drops

For the past few months I have been chasing down an issue which has been plaguing my attempts at tempdb monitoring, and in just the last week I’ve received news that it is indeed a confirmed bug in SQL Server.  I’m sharing what I’ve found here for the benefit of the SQL community. One of  Read more »

May 21, 2013 Posted by: 4 Comments - Permalink

Obfuscated T-SQL Holiday Cards

As a student I was always a great fan of the International Obfuscated C Code Contest.  If you’re not familiar with obfuscation contests, they’re basically a two part brain teaser for coders.  The first part, and the one I find really satisfying, is to write code to do some task in a completely non-obvious way  Read more »

December 22, 2012 Posted by: 3 Comments - Permalink

Troubleshooting “A severe error occurred on the current command.”

I thought it might be useful to start a semi-regular series of entries on troubleshooting for the SQL Server developer. Google has come to my rescue lo, these many times: this is my way of returning the favor. For this first entry I thought I’d tackle one of the more mysterious-looking runtime errors I see  Read more »

March 21, 2012 Posted by: 6 Comments - Permalink

Speaking at SQLSaturday #111 in Atlanta on April 14

A month from today on April 14, 2012 I’ll be speaking at SQLSaturday #111 in Atlanta, GA (or, more precisely, in Alpharetta, GA).  This will be my first trip to Georgia and I’m delighted to be able to present alongside some of the biggest names in the SQL Server community.  It’s a great honor to be  Read more »

March 14, 2012 Posted by: Leave a comment - Permalink

Using Excel to parse Set Statistics IO output

When tuning T-SQL, “set statistics io on” is definitely your friend. However, I know I cannot be the only developer whose eyes glaze over when I flip over to the Messages tab in SSMS and am greeted with this: That 58-line monstrosity is brought to us by our friend sp_help. Scanning through all that output  Read more »

March 7, 2012 Posted by: 12 Comments - Permalink

Data Type Conversions with Coalesce and IsNull

One topic I have spoken on a few times in the past few months, but have not elaborated on a great deal, is the issue of bugs caused by data type conversions when using the IsNull expression in T-SQL.  This is a relatively subtle issue, though, and deserving of some attention, so I thought I  Read more »

February 22, 2012 Posted by: 1 Comment - Permalink