Concatinate a column
Concatinate a column. Seperate the data by comma.
Last updated:
Warning: Review and test in a non-production environment before running.
DECLARE @Names VARCHAR(8000)
SELECT @Names = COALESCE(@Names + ', ', '') + FirstName
FROM Person.Person
WHERE FirstName IS NOT NULL
select @names
DECLARE @Names VARCHAR(8000)
SELECT @Names = COALESCE(@Names + ', ', '') +
ISNULL(FirstName, 'N/A')
FROM Person.Person
select @names