ISNULL (TSQL Function)

Returns the expression if it is not NULL. Else, returns the replacement value.

Syntax

ISNULL ( expression , replacement_value )

Arguments

expression
is an expression of any type.
replacement_value
if expression is NULL, replacement_value will be returned.

Return Types

Returns the same type as expression.

Examples

DECLARE @a INT; -- @a is NULL

PRINT ISNULL(@a, 123);
PRINT ISNULL(9000, 123);

The result is:

123
9000
RSQL, a simple alternative to Microsoft SQL Server