Converting multiple comma-separated columns into rows
0
votes
2
answers
2390
views
I have an SQL Server database table that holds comma separated values in many columns. For example:
| id | Column B |column c |
| -------- | -------- |-------- |
| 1 | a,b,c, |1,2,3, |
| 2 | d, ,f, |4,5,6, |
| 3 | g,h,i,j, |7, ,9,8, |
I want to split all the columns into rows and the output should be this:
| id | Column B |column c |
| -------- | -------- |-------- |
| 1 | a | 1 |
| 1 | b | 2 |
| 1 | c | 3 |
| 2 | d | 4 |
| 2 | | 5 |
| 2 | f | 6 |
| 3 | g | 7 |
| 3 | h | |
| 3 | i | 9 |
| 3 | j | 8 |
I have just given the idea of how to convert these into rows, but my actual columns are more than 30 that need to be separated by comma.
Asked by jawad riaz
(3 rep)
Aug 29, 2023, 07:51 AM
Last activity: Aug 30, 2023, 10:29 AM
Last activity: Aug 30, 2023, 10:29 AM