what is ISNULL, NULLIF, COALESCE in SQL function. difference between IsNull, NullIF and COALESCE in sql function.
SQL tutorials for beginners. Sql interview question and answer.
ISNULL (check_exp, change_value)
The Coalesce() function returns the first non-null value among its arguments.
The ISNULL() function contains only two parameters. The COALESCE() function contains multiple parameters.
The ISNULL() function contains various types of parameters.
The COALESCE() function doesn't limit the number of arguments, but they must all be of the same data type.
------------------------------
SELECT ISNULL(NULL,'test')
select coalesce(null,null,null,'Test')
---------------
DECLARE @Parm1 VARCHAR(5)='Hello',
@parm2 int =5
SELECT ISNULL(@Parm1, @parm2) AS ISNULLResult
SELECT COALESCE(@Parm1, @parm2) AS COALESCEResult