How to Use Coalesce

The coalesce function returns the first non null parameter, it is similar to isnull function. Using the previous table test, we can do:

Select name2, coalesce(name2 , 'xxxxxx') AS result_coalesce from test;
name2 result_coalesce
John John
Peter Peter
null xxxxxx

IN THIS PAGE