T-SQL Style Guide, Tested: Series Contents

My T-SQL style guide, tested instead of asserted.

A woman engineer tests a wrench against a bench of round gauges, most showing their needles in the green zone.

Each post takes one rule and checks it against SQL Server: ISNULL truncation, NOT IN with a NULL, double-hyphen comments, COALESCE in a WHERE clause, COUNT and COUNT_BIG, nested transactions, NOLOCK, and snapshot isolation. The last two posts explain why I keep a style guide, and how a plan analysis skill showed me that the reason behind one of my rules was wrong.

  1. ISNULL Truncates Your Replacement Value; COALESCE Doesn’t
  2. One NULL in the List and NOT IN Returns Nothing
  3. Double-Hyphen Comments Can Comment Out Your WHERE Clause
  4. COALESCE in a WHERE Clause Costs You the Row Estimate
  5. COUNT Under the Hood
  6. A Nested COMMIT Does Not Commit Anything
  7. NOLOCK Returned a Balance That Never Existed
  8. The SET Succeeds and the Catalog Read Succeeds, Then Msg 3951
  9. Why I Keep a T-SQL Style Guide, and What Testing It Cost Me
  10. A Plan Analysis Skill That Refuses to Let You Cite Cost

Questions or corrections are welcome on Bluesky or LinkedIn. See all series on this blog.