Explain about SQL COALESCE..

 Posted by Bharathi Cherukuri on 7/24/2012 | Category: Sql Server Interview questions | Views: 1788 | Points: 40

This COALESCE function is used to return a value which is the first non-null expression among all its arguments.
If all the arguments are NULL, in that case COALESCE will return NULL.
It is also used to display any other value instead of NULL value in the result.


SELECT Name, COALESCE(Business_Phone, Cell_Phone, Home_Phone) Contact_Phone
FROM Contact_Info;


Name Contact_Phone
Jeff 531-2531
Laura 772-5588
Peter 594-7477

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response