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]
Comments
Post a Comment