T-SQL Anti-Patterns: Wrapup

Over on the right-hand bar, I have a page listing all of the T-SQL anti-patterns in this series.  There are additional anti-patterns, code smells, and things to avoid, but I think 14 is enough for one presentation.  Speaking of presentations, check it out at SQL Saturday #277 in Richmond, Virginia on Saturday, March 22nd, 2014.

Advertisement

Theory of gaming: Cold War: CIA vs. KGB

Publisher: Fantasy Flight Games Type of game: Card game, bluffing, Cold War awesomeness Number of players: 2 Learning curve: Easy+ Estimated time to play (first time/subsequent times): 45 minutes/30 minutes Estimated setup time: 4 minutes I found this game for sale for about $20, and it's a tremendous value. Each player chooses a side, KGB…

T-SQL Anti-Patterns: Clustered GUIDs

My final T-SQL anti-pattern that I'm going to discuss is using GUIDs as a clustered index.  This is a particularly pernicious problem because it's so easy for developers to fall into it. A GUID, or globally unique identifier, is a 16-byte field which is (supposed to be) truly unique.  You can run into duplicates when…

T-SQL Anti-Patterns: Linked Server Joins

Yesterday's anti-pattern, non-SARGable ORs in joins, was all about writing code which the SQL Server database engine can optimize.  Today's anti-pattern is in that vein, but this time we're looking at cross-server queries. Linked servers are a powerful feature within SQL Server, and I don't want to throw them out entirely.  What I do want…