Some parts in the output code are omitted for clarity reasons.
Description
Evaluates the arguments in order and returns the current value of the first expression that initially doesn't evaluate to NULL. For example, SELECT COALESCE(NULL, NULL, 'third_value', 'fourth_value'); returns the third value because the third value is the first value that isn't null. ().
Sample Source Pattern
Syntax
COALESCE ( expression [ ,...n ] )
COALESCE( <expr1> , <expr2> [ , ... , <exprN> ] )
Examples
Code:
IN -> SqlServer_01.sql
SELECT TOP 10 StartDate,
COALESCE(EndDate,'2000-01-01') AS FIRST_NOT_NULL
FROM HumanResources.EmployeeDepartmentHistory