Tuesday, February 9, 2010

Creating a CSV Text from Table Columns

Select Name from Users


Name
----
Ramu
Saju
Nattu


SELECT SUBSTRING((SELECT ',' + s.Name FROM Users s ORDER BY s.Name FOR XML PATH('')),2,200000) AS CSV

No comments:

Post a Comment