How to transpose CSV string in rows? In the example below, rows are transposed into CSV string but I would like to do the inverse operation (split this string "Day,Evening,Night" into rows)?. How to do that?
USE AdventureWorks
GO
-- Check Table Column
SELECT [Name]
FROM HumanResources.Shift
GO
-- Get CSV values
SELECT STUFF(
(SELECT ',' + s.Name
FROM HumanResources.Shift s
ORDER BY s.Name
FOR XML PATH('')),1,1,'') AS CSV
GO
The example is taken from here.