SQL Server ISNULL() Function
Example
Return an alternative value IF the expression is NULL:
SELECT ISNULL(NULL, 'W3Schools.com');
Try it Yourself »
Definition and Usage
The ISNULL() function lets you return an alternative value when an expression is NULL.
Syntax
ISNULL(expression, alt_value)
Parameter Values
Parameter | Description |
---|---|
expression | Required. The value to test whether is NULL |
alt_value | Required. The value to return if expression is a NULL value |
Note
- The ISNULL() function returns the alt_value, if the expression is a NULL
- The ISNULL() function returns the expression, if the expression is NOT NULL
Technical Details
Works in: | SQL Server 2014, SQL Server 2012, SQL Server 2008 R2, SQL Server 2008, SQL Server 2005 |
---|
More Examples
Example
Return an alternative value IF the expression is NULL:
SELECT ISNULL('Hello', 'W3Schools.com');
Try it Yourself »
Example
Return an alternative value IF the expression is NULL:
SELECT ISNULL(NULL, 500);
Try it Yourself »