In a greedy attempt to win an interesting blogger contest, and because I see this stuff all the time when dealing with inherited code or answering questions in newsgroups or forums, I decided to put together a series of blog posts designed to help fellow SQL Server dabblers to kick some of the bad habits they’ve picked up over the years.
It actually started long before the contest, but at the time was aimed more at picking up good habits. Last year, I wrote an elaborate post detailing my own personal “best practices” checklist that I try to follow when writing stored procedures. And earlier this year, I wrote about always terminating statements with semi-colons.
It can be hard to enforce good habits; it is much easier to demonstrate why bad habits are bad, and drive positive habits simply by providing motivation to avoid the negative ones. So, the series was kicked off last week, and so far I have written sixteen “here’s why you should stop doing x” articles. There has been great feedback on the articles themselves, several discussions have launched because of them, and I’ve even spurred other people to write their own posts to complement the series.
Who knows, maybe the series will be good enough to see my name in lights at PASS. But more importantly, maybe it will help you, or someone you work with, to kick some bad habits.
Bad habits to kick : ORDER BY ordinal
Bad habits to kick : using loops to populate large tables
Bad habits to kick : using old-style JOINs
Bad habits to kick : using table aliases like (a, b, c) or (t1, t2, t3)
Bad habits to kick : declaring VARCHAR without (length)
Bad habits to kick : using dashes and spaces in entity names
Bad habits to kick : using SELECT or RETURN instead of OUTPUT
Bad habits to kick : using SELECT * / omitting the column list
Bad habits to kick : avoiding the schema prefix
Bad habits to kick : inconsistent naming conventions
Bad habits to kick : making assumptions about IDENTITY
Bad habits to kick : choosing the wrong data type
Bad habits to kick : abusing triggers
Bad habits to kick : using the visual designers
Bad habits to kick : using alias types
Bad habits to kick : mis-handling date / range queries
Aaron Bertrand
Senior Data Architect, OTOlabs
http://www.otolabs.com
Tags: bad habits, best practices, sql server

[...] This post was mentioned on Twitter by Aaron Bertrand, OTOlabs and Tampa Bay SSUG. Tampa Bay SSUG said: Great series! RT @AaronBertrand: Blogged about my "bad habits" series : http://bit.ly/1dZv6G [...]
[...] been fairly distracted this past week with my “Bad habits to kick” series, so apologies for being so late with the Connect digest. I stumbled upon a few pretty [...]
[...] in October, I started a series of blog posts called “Bad Habits to Kick,” and thought I would revive the [...]
[...] October, I started a series of blog posts over on sqlblog.com that highlighted some bad practices I observe from time to time. Earlier [...]