
Hi Saranya,
NULLIF
NULLIF is used to compare two epressions
1. If both the expressions are same it returns NULL value.
2. If both the expressions are different returns the first expression.
NOTE : The first expression should not be NULL while using NULLIF function.
Syntax :
NULLIF(expresion,expresion)
Example:
select nullif(12,12)[1],nullif(0,100)[2],nullif(12,NULL)[3]
Output:
1 2 3
NULL 0 12
ISNULL
ISNULL is used to replace the NULL value
1. If first expression is NULL it replaces the second expression.
2. If first expression is not NULL it retain its value.
Syntax:
ISNULL(expression,replacement value)
Example:
select ISNULL(1,5)[1],ISNULL(NULL,4)[2],ISNULL(null,null)[3]
Output:
1 2 3
1 4 NULL
Saranya Boopathi, if this helps please login to Mark As Answer. | Alert Moderator