ISNULL function [Miscellaneous]

Returns the first non-NULL expression from a list. This function is identical to the COALESCE function.

Syntax
ISNULL( expression, expression [, ...] )
Parameters
  • expression   An expression to be tested against NULL.

    At least two expressions must be passed into the function, and all expressions must be comparable.

Returns

The return type for this function depends on the expressions specified. That is, when the database server evaluates the function, it first searches for a data type in which all the expressions can be compared. When found, the database server compares the expressions and then returns the result in the type used for the comparison. If the database server cannot find a common comparison type, an error is returned.

See also
Standards and compatibility
  • SQL/2003   Vendor extension.

Example

The following statement returns the value -66.

SELECT ISNULL( NULL ,-66, 55, 45, NULL, 16 );