SQL Server Science

Technical Articles for the DBA / Developer

Home

One NULL Turns the Whole Concatenation Into NULL

2026-09-23 · by Hannah Vernon · in t-sql

With +, one NULL operand makes the whole concatenation NULL and a built-up label vanishes. Use CONCAT, COALESCE, or CONCAT_WS instead.

COUNT, AVG, and the NULLs Your Aggregates Ignore

2026-09-22 · by Hannah Vernon · in t-sql

COUNT(column), AVG, and COUNT(DISTINCT) ignore NULL but COUNT(*) does not, so totals stop matching. How to pick the right aggregate.

The CHECK Constraint That Lets NULL Through

2026-09-21 · by Hannah Vernon · in t-sql

A CHECK constraint accepts a row when its predicate is UNKNOWN, so CHECK (quantity >= 0) still allows NULL. How to close the gap.

The Inequality Filter That Drops Your NULL Rows

2026-09-20 · by Hannah Vernon · in t-sql

A WHERE inequality drops rows where the column is NULL, because the comparison is UNKNOWN. When to add OR col IS NULL, and when not to.

NOT IN With a NULL Returns Nothing

2026-09-19 · by Hannah Vernon · in t-sql

One NULL in a NOT IN subquery makes the whole predicate UNKNOWN and returns zero rows. Why it happens and how NOT EXISTS fixes it.

The MERGE That Would Not Update: A NULL in Your Change Detection

2026-09-18 · by Hannah Vernon · in t-sql

A MERGE upsert skips a NULL-to-value change and updates nothing, with no error. The three-valued-logic cause and two NULL-safe fixes.

1 2 … 56 Next »

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
  • 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