I am using SQL Server 2019 to separate comma-separated lists of values.
I have a table that looks like the following
I would like to run a query on the table produce and output that looks like this:
From what I've read StackOverflow there isn't a built in function that can split out the commas as I would like. However, I have seen the cross apply String_Split
function that I think might work, but I could only get it to work on a single column.
The table structure is as follows:
CREATE TABLE neighbourhoods3.dbo.timeslots
(
year VARCHAR(50) NULL,
time_of_day VARCHAR(50) NULL,
day_of_week VARCHAR(50) NULL,
month VARCHAR(50) NULL,
season VARCHAR(50) NULL,
public_holiday VARCHAR(50) NULL,
public_holiday_minus_1 VARCHAR(50) NULL
) ON [PRIMARY]
GO