Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Convert Comma separated values to different rows for multiple Columns

$
0
0

Hi All,

I need some help in getting the output in a specific manner. After some searching on the web, I found the solution if we have only one column that has comma separated values and need to convert them in to rows. But In my case, I have multiple columns which has comma separated values.

example DML is below:

Create Table Units
(
UnitID Int,
UnitA Varchar(20),
UnitB Varchar(20),
UnitC Varchar(20),
unitE Varchar(20)
)

Insert INTO Units VALUES (123, '111,222','456,625', null,null)
Insert INTO Units VALUES (454,null, 159,999,'785,895')
Insert INTO Units VALUES (789,555,null,'888,756,415','444,912,2323')
Insert INTO Units VALUES (110,566,232,565,963)

Any help would be greatly appreciated.

Thanks,

Ram


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>