CONCAT function ignores NULLs:
SELECT CONCAT(LEFT(LastName, 1), ',' , LEFT(FirstName, 1), ' ' + LEFT(MiddleName, 1)) theNameWithInitials FROM myTable
If you use CONCAT, you will not need to worry about whether LEFT(X) is null or not.
Daily micro-tips for C#, SQL, performance, and scalable backend engineering.
CONCAT function ignores NULLs:
SELECT CONCAT(LEFT(LastName, 1), ',' , LEFT(FirstName, 1), ' ' + LEFT(MiddleName, 1)) theNameWithInitials FROM myTable
If you use CONCAT, you will not need to worry about whether LEFT(X) is null or not.