Comma seperated list - another approach

,

This will make a comma seperated list from a column using 2 select statements.

-- test using pubs database
USE PUBS
GO

-- return csv
declare @value varchar(8000)
set @value = '"'
select @value = @value + emp_id + '", "' from employee
select substring(@value, 1, len(@value) -3) as csv

Rate

Share

Share

Rate