What is ISNULL() in SQL?

The ISNULL() function returns 1 if the expression sent as a parameter is NULL; otherwise, it returns 0.

Figure 1 shows a visual representation of the ISNULL() function.

Figure 1: Visual representation of ISNULL() function

Syntax

ISNULL(exp)

Parameter

The ISNULL() function takes the expression as a parameter.

Return value

The ISNULL() function returns 1 if the expression sent as a parameter is NULL; otherwise, it returns 0.

Example

-- NULL expression
SELECT ISNULL(NULL);
-- not NULL expression
SELECT ISNULL('educative');
SELECT ISNULL(12345);

Free Resources