
Last October, I started a series of blog posts over on sqlblog.com that highlighted some bad practices I observe from time to time. Earlier this year, I felt motivated to pick the series up again.
I’ve always felt a sense of accomplishment pointing these elements of faux pas out to the community, especially since I’ve overcome several of them myself (and am still working on a few). Since a reader pointed out that there was no visible checklist for the series, I thought I would provide an updated “table of contents” in case you are interested in any of these individually.
October 2009:
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
February 2010:
Bad habits to kick : putting an IDENTITY column on every table
Bad habits to kick : relying on undocumented behavior
Bad habits to kick : blind SQL Server installs
Bad habits to kick : ignoring the principle of least privilege
Bad habits to kick : inconsistent table aliasing
Bad habits to kick : using ancient copies of Books Online
March 2010:
Bad habits to kick : creating the uber-view
Bad habits to kick : ignoring I/O
I’m running out of topics to rant about, but keep watching this space; you never know when a new pet peeve will emerge.
Aaron Bertrand
Senior Data Architect, OTOlabs
http://www.otolabs.com
Tags: bad habits, best practices, sql server