Hi Everyone,
This blog helps you to display the table column value to comma seperated values.
First we have to select the table and before the column name, kindly add a ','.
Then keep the select as inner query and use substring in the select query.
This substring will need 3 parameters - Expression,Start-Position,Length.
Give this as it is! the value 2 has given as start position to remove the first comma present in the final list.
SELECT SUBSTRING(
(SELECT ',' + s.Name
FROM HumanResources.Shift s
ORDER BY s.Name
FOR XML PATH('')),2,200000) AS CSV
GO
(SELECT ',' + s.Name
FROM HumanResources.Shift s
ORDER BY s.Name
FOR XML PATH('')),2,200000) AS CSV
GO
By this way, We can make the table to csv..
Regards
M.K.Kannan..
M.K.Kannan..