The IsNull()
function accepts two parameters, and returns the second parameter if the first one is null
.
Parameters:
The IsNull()
function returns the same data type as the check expression.
DECLARE @MyInt int -- All variables are null until they are set with values.
SELECT ISNULL(@MyInt, 3) -- Returns 3.
See also COALESCE
, above