I need to turn
Key Location
123456 UK,France,Italy
into
Key Location
123456 UK
123456 France
123456 Italy
Any ideas? Thanks
I need to turn
Key Location
123456 UK,France,Italy
into
Key Location
123456 UK
123456 France
123456 Italy
Any ideas? Thanks
Typically, assuming SQL Server 2016 or better, this is:
SELECT t.[Key], Location = s.value
FROM dbo.TableName AS t
CROSS APPLY STRING_SPLIT(t.Location, N',') AS s;
If you're on < 2016 (or >= 2016 but < 130 compatibility level), you'll need to create a separate inline TVF to handle this (example forthcoming if necessary).