Handle Null
IS NULL
IS NULL operator is to compare the values with Null in the table. It occupies 0-byte memory.
ISNULL() accepts two arguments:
- expression :- an expression of any type that is checked for NULL.
- replacement :- is the value to be returned if the expression is NULL. The replacement must be convertible to a value of the type of the expression.
Returns
The ISNULL() function returns the replacement if the expression evaluates to NULL. Before returning a value, it implicitly converts the type of replacement to the type of the expression if the types of the two arguments are different. In case the expression is not NULL, the ISNULL() function returns the value of the expression.
IS NULL command
The IS NULL command is used to test for empty values (NULL values).SELECT *
A NULL value is different from a zero value or a field that contains spaces. A field with a NULL value is one that has been left blank during record creation!
Always use IS NULL to look for NULL values.