asked on
SELECT (COALESCE(LastName,'') + ',' + COALESCE(FirstName,'') + ' ' + COALESCE(MiddleName)) AS FullName, ColumnD, ColumnE
FROM Table
ORDER BY 1 ASC
ASKER
SELECT (COALESCE(LastName,'') + ',' + COALESCE(FirstName,'') + ' ' + COALESCE(MiddleName,'')) AS FullName, ColumnD, ColumnE
FROM Table
ORDER BY 1 ASC
ASKER
SELECT (COALESCE(LastName,'') + ',' + COALESCE(FirstName,'') + ' ' + COALESCE(MiddleName,''), COALESCE(', ' + Suffix,'')) AS FullName, ColumnD, ColumnE
FROM Table
ORDER BY 1 ASC
ASKER
SQL (Structured Query Language) is designed to be used in conjunction with relational database products as of a means of working with sets of data. SQL consists of data definition, data manipulation, and procedural elements. Its scope includes data insert, query, update and delete, schema creation and modification, and data access control.
TRUSTED BY
However, I suggest you look at using Coalesce to filter the columns you're adding togehter. If you have a NULL in any of those fields, the whole thing would be NULL...
SELECT (COALESCE(ColA,'') + ',' + COALESCE(ColB,'') + ',' + COALESCE(ColC)) AS FullName, ColD, ColE
FROM Table