I will be presenting at SQL Saturday #277 in Richmond, Virginia on Saturday, March 22, 2014. My topic is T-SQL anti-patterns.
Abstract: Experience with a platform gives us patterns: common techniques which we can use to solve a number of recurring problems. They also give us anti-patterns: common techniques we often use to solve a number of recurring problems incorrectly. This session will cover a number of anti-patterns related to writing T-SQL code. We will cover each anti-pattern in detail, explaining the problem, why you might reach for the anti-pattern, and better alternatives which won’t leave you hurting for performance.
Over the next several days, as I flesh out my final presentation, I’m going to throw out some T-SQL anti-patterns. Not all of these will make it into the talk—I only have 60 minutes, after all—and I don’t promise to have the end-all, be-all on this topic, but it should at least be enough to get an interested person started.
Tonight, I’m going to spend a little bit of time on further resources. Although most of the topics in my talk come from personal experience, I found a number of good resources which corroborated my experience and also gave me some ideas that I had originally forgotten.
From there, you could hit Stack Overflow for a laundry list of problems, or Google the topic. One of my favorite blog posts on the topic argues that a large percentage of anti-patterns stem from a procedural mindset. I completely agree, and that will be something I bring up several times. It’s hard to keep separate the idioms and mechanics of a fourth-generation language like SQL from third-generation languages like C#, Python, or Ruby. When you start conflating the two, you end up with anti-patterns.