How could I convert this sql table
| col1 |
|---|
| a ,b ,c |
| a ,d ,e |
to be like that
| col1 |
|---|
| a |
| b |
| c |
| a |
| d |
| e |
CodePudding user response:
You can split string like this:
SELECT
value
FROM
STRING_SPLIT('a,b,c', ',');
CodePudding user response:
It seems your delimited data is in a column. If so, you can use string_split() in concert with a CROSS APPLY
Select col1=B.value
From YourTable A
Cross Apply string_split(A.col1,',') B
