NULLIF returns a null value if the two specified expressions are equal.
SELECT NULLIF (colA, 0)
NULLIF is good to prevent 'divide by zero' issues, by converts the column that can be zero to NULL, and than the result will be NULL and not ERROR (divide by NULL = NULL).
No comments:
Post a Comment