SQL Flow Field Guide

Comparison (overview)

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

none (documentation, rules or examples)

What changes

Input
none
Output or change
none

Syntax at a glance

DECLARE @MyProduct INT; SET @MyProduct = 750; IF (@MyProduct <> 0) SELECT ProductID, Name, ProductNumber FROM Production.Product WHERE ProductID = @MyProduct;

Work example

A search condition needs a comparison rule for equal, lower, higher, and missing values.

Test both sides of each boundary and handle NULL with IS NULL or IS DISTINCT FROM as required.

Check your work Comparison (overview). The comparison includes the correct boundary rows and has a separate rule for NULL.

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