T-SQL statement that returns the first non-null expression from among it's arguments.

Let's say you have a table that has three columns that describe the wages of an employee: curHourlyWage, curSalary, and curCommission. Each employee can only have one method of calculating their paycheck. You could do the select statement weeding out the null values in your code OR you could use the coalesce function as follows:

SELECT CAST(COALESCE(curHourlyWage * 40 * 52, curSalary, curCommission * intNumSales) AS money) AS 'Total Salary' FROM wages

This statement would pull the first non-null value found, do any calculations, then return the value as 'Total Salary.' So for a table such as:

Employee | Hourly Wage | Salary | Commission
John Doe      16.35
Sally Mo                                                    75.00
Nate O.                                  82,000

You would get the following returned to you:

Employee | Total Salary
John Doe     34,008 (assuming 40hrs x 52weeks)
Sally Mo        30,000 (assuming 400 sales)
Nate O.         82,000 (assuming I hit the lottery next week and make that donation I want to)