COALESCE – Return first non-NULL value from multiple choices
03 years ago
in Transact-SQL
Whilst studying for my MCITP Database Developer certification, I have come across a very useful function that returns the value of the first non-NULL value from multiple choices:
SELECT LastName, FirstName, COALESCE(MobilePhone, HomePhone) AS Phone
If the MobilePhone field is blank, it will use the [...]
Create a stored procedure using a parameter default of NULL
03 years ago
in Transact-SQL
The default value of a parameter can be specified as NULL. In this case, if you do not supply a parameter, SQL Server executes the stored procedure according to its other statements. No error message is displayed.
The procedure definition can also specify that some other action be taken if you do [...]