Return TRUE if the expression is not NULL, otherwise FALSE.
ISNOTNULL(expr)
## Overview Returns TRUE if the expression is not NULL and FALSE otherwise. ISNOTNULL is the functional form of the IS NOT NULL predicate and can be used in any boolean expression context. ## Behavior - Returns FALSE only when the argument is NULL. - Returns TRUE for all non-NULL values, including 0, '', false, and empty arrays. - Never returns NULL. - Accepts any scalar, composite, or array type. - Equivalent to (expr IS NOT NULL). ## Compatibility - Equivalent to the SQL-standard IS NOT NULL predicate. Prefer IS NOT NULL for portability; use ISNOTNULL when the codebase convention is functional-form null tests.
| Name | Type | Description |
|---|---|---|
expr | Specifies the expression to test for non-nullity. Accepts any data type. |
-- Non-NULL returns TRUE
SELECT ISNOTNULL(42) AS v; -- true
-- NULL returns FALSE
SELECT ISNOTNULL(NULL) AS v; -- false
-- Empty string is not NULL
SELECT ISNOTNULL('') AS v; -- true
-- Filter rows with a non-NULL value
SELECT val
FROM (VALUES (1), (NULL), (3)) AS t(val)
WHERE ISNOTNULL(val);
-- Realistic: compute coverage on a column
SELECT COUNT(*) AS total,
SUM(CASE WHEN ISNOTNULL(email) THEN 1 ELSE 0 END) AS with_email
FROM iam.directory.users;