I have a table like this
Value String
-------------------
1 Cleo, Smith
I want to separate the comma delimited string into two colu
You can use a table-valued function STRING_SPLIT
, which is available only under compatibility level 130. If your database compatibility level is lower than 130, SQL Server will not be able to find and execute the STRING_SPLIT
function. You can change a compatibility level of the database using the following command:
ALTER DATABASE DatabaseName SET COMPATIBILITY_LEVEL = 130
Syntax
SELECT * FROM STRING_SPLIT ( string, separator )
see documentation here