If the first expression is the NULL value, then the value of the second expression is returned. If the first expression is not NULL, the value of the third expression is returned. If the first expression is not NULL and there is no third expression, NULL is returned.
IFNULL( expression-1, expression-2 [ , expression-3 ] )
expression-1 The expression to be evaluated. Its value determines whether expression-2 or expression-3 is returned.
expression-2 The return value if expression-1 is NULL.
expression-3 The return value if expression-1 is not NULL.
The data type returned depends on the data type of expression-2 and expression-3.
SQL/2003 Transact-SQL extension.
The following statement returns the value -66.
SELECT IFNULL( NULL, -66 );
The following statement returns NULL, because the first expression is not NULL and there is no third expression.
SELECT IFNULL( -66, -66 );
|Discuss this page in DocCommentXchange.
Send feedback about this page using email.
|Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1|