In this post explains how to use the COALESCE function in SQL Server (Transact-SQL) with syntax and examples.
In SQL Server (Transact-SQL), the COALESCE function returns the first non-null expression in the list. If all expressions evaluate to null, then the COALESCE function will return null.
The syntax for the COALESCE function in SQL Server (Transact-SQL) is:
The expressions to test for non-null values.
The COALESCE function can be used in the following versions of SQL Server (Transact-SQL):
Let's look at some SQL Server COALESCE function examples and explore how to use the COALESCE function in SQL Server (Transact-SQL).
For example: