SQL Flow Field Guide

IS DISTINCT FROM

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

NULL-safe comparison

What changes

Input
two expressions
Output or change
TRUE or FALSE (never UNKNOWN)

Syntax at a glance

expression IS [NOT] DISTINCT FROM expression

Work example

A comparison must treat NULL as a value so two missing values can compare as equal.

Check equal values, unequal values, and both NULL and non-NULL combinations. Keep this predicate separate from ordinary equality tests.

Check your work IS DISTINCT FROM. The predicate returns false for NULL versus NULL and true when only one side is NULL.

Practice SQL

Open in SQL Flow
SELECT CASE WHEN CAST(NULL AS int) IS DISTINCT FROM 1 THEN N'different' ELSE N'equal' END AS Result;

Open Microsoft Learn for full syntax, permissions, and details for your version.