Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

sql server: how to concatenate column data using comma

DECLARE @CarList nvarchar(max);
SET @CarList = N'';
SELECT @CarList+=CarName+N','
FROM dbo.CARS;
SELECT LEFT(@CarList,LEN(@CarList)-1);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sql #concatenate #column #data #comma
ADD COMMENT
Topic
Name
1+7 =