What is the difference between COALESCE() and ISNULL()?

Both functions are used to return the first not null value among all the input values passed.

ISNULL():

  • It takes only two parameters.
  • ISNULL() is T – SQL specific function.
  • The return data type of ISNULL() is the datatype of the first argument value.
  • If both parameters values are NULL, its datatype will be INT.

Coalesce():

  • It takes n number of parameters.
  • Coalesce() is ANSI standard.
  • The return type of Coalesce() is the datatype of the input parameter which has highest precedence.
  • If all the parameters values are NULL, it throws error.

Happy Reading :-) 

Leave a Reply

Your email address will not be published. Required fields are marked *