Posts

Showing posts from March 20, 2011

Convert the columns into a comma separated string in T-Sql

Convert the columns into a comma separated string in T-Sql Input :- test1 test2 test3 test4 Output:-             test1,test2,test3,test4 Query:- SELECT STUFF((SELECT ', ' +convert(nvarchar, name) FROM (SELECT name FROM Locations_Alternative where LID=234) AS T FOR XML PATH('')),1,1,'') AS [Name]