ISNULL
NULL replacement
What changes
- Input
- check expression and replacement
- Output or change
- replacement when the first is NULL (typed as the first argument)
- Return type
- Returns the same type as check_expression. If a literal NULL is provided as check_expression, ISNULL returns the data type of the replacement_value. If a literal NULL is provided as check_expression a
Syntax at a glance
ISNULL ( check_expression , replacement_value )
Work example
Replace one nullable expression with a fallback of the intended output type.
Cast the first argument when the fallback must determine a wider result type.
Check your work ISNULL returns the type of its first argument, so a longer replacement can be truncated.
Practice SQL
Open in SQL FlowSELECT ISNULL(CAST(NULL AS varchar(12)), 'not supplied') AS label;
Open Microsoft Learn for full syntax, permissions, and details for your version.