NEWS

Monday, January 30, 2012

Query to concatenate column values without loop


DECLARE @Vals varchar(500)
SET @Vals=''
SELECT @Vals= ISNULL(@Vals,'') + CAST(Col1 AS VARCHAR(3)) + ',' from tblData
SELECT @Vals

6 comments: