rows to comma separated values in mssql
snippet in sql

rows to comma separated values in mssql

user2245

DECLARE @test NVARCHAR(max)  
SELECT @test = COALESCE(@test + ',', '') + field2 FROM #test
SELECT field2 = @test