SQL Server Science
Technical Articles for the DBA / Developer
Home » Blog Series » The UNKNOWN Problem: NULL Traps in T-SQL, Series Contents

The UNKNOWN Problem: NULL Traps in T-SQL, Series Contents

A nine-part series on NULL traps in T-SQL.

A woman explorer tests the tiles ahead with a long pole as she crosses a floor where some tiles are ghostly and some have opened into trap doors.

Each post shows one place where three-valued logic turns a comparison into UNKNOWN and changes a result without raising an error: MERGE change detection, NOT IN, inequality filters, CHECK constraints, aggregates, string concatenation, ISNULL versus COALESCE, unique keys and joins. The last part shows INTERSECT and EXCEPT, where NULL compares the way most people expect.

  1. The MERGE That Would Not Update: A NULL in Your Change Detection
  2. NOT IN With a NULL Returns Nothing
  3. The Inequality Filter That Drops Your NULL Rows
  4. The CHECK Constraint That Lets NULL Through
  5. COUNT, AVG, and the NULLs Your Aggregates Ignore
  6. One NULL Turns the Whole Concatenation Into NULL
  7. ISNULL vs COALESCE: Not as Interchangeable as They Look
  8. One NULL in a Unique Key, and None Across a Join
  9. INTERSECT and EXCEPT: Where NULL Finally Behaves

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

Share this:

  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Bluesky (Opens in new window) Bluesky
  • Share on Mastodon (Opens in new window) Mastodon
  • Email a link to a friend (Opens in new window) Email
  • More
  • Share on Threads (Opens in new window) Threads
  • Share on Reddit (Opens in new window) Reddit
  • Share on Facebook (Opens in new window) Facebook
  • Share on WhatsApp (Opens in new window) WhatsApp
  • Print (Opens in new window) Print

Like this:

Like Loading…

Search

Categories

  • AI for DBAs
  • announcements
    • events
  • basics
    • localization
  • configuration
  • Data Architecture
  • DMVs
  • documentation
  • extended-events
  • Git for DBAs
  • High Availability
  • Hot Takes
  • Internals
  • maintenance
    • patching
  • Opinion
  • performance
  • PostgreSQL
  • Professional Development
  • recovery
  • reporting
  • ROLLBACK;
  • security
    • data security
  • service broker
  • SQL Server Agent
  • statistics
  • sys
  • t-sql
    • xml
  • tools
    • data masking
    • wsus
  • troubleshooting
  • Uncategorized

Pages

  • About SQL Server Science
  • Blog Series
    • Backup & Recovery from First Principles: Series Contents
    • Database as a Versioned Contract: Series Contents
    • Extended Events in Production: Series Contents
    • Git for DBAs: Series Contents
    • How SQL Server Stores Data: Series Contents
    • Logins, SIDs, and Kerberos from First Principles: Series Contents
    • Proving the Restore: Series Contents
    • T-SQL Style Guide, Tested: Series Contents
    • The UNKNOWN Problem: NULL Traps in T-SQL, Series Contents
    • Undocumented Changes in SQL Server 2022 and 2025: Series Contents
    • Work That Flows: Kanban for DBAs: Series Contents
  • Get Better Help with a Minimal, Complete, and Verifiable Example, or MCVE
  • Privacy Policy

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.

To find out more, including how to control cookies, see here: Cookie Policy

Copyright © 2026 SQL Server Science

%d