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

Split the value into multiple values across the row

$
0
0


I have the values in the following way

Source

Test

RT,59,79
LT,59
RT,59,79,51

FT

I want the result set in the following way

Expected Result Set

Test                       Test1    Test2    Test3   Test4

RT,59,79                 RT           59        79          null
LT,59                      LT           59        null         null  
RT,59,79,51            RT           59        79          51

FT                           FT          NULL   NULL       NULL

I tried the char index but as the values are variable lenghth I am getting error specific to the

Invalid length parameter passed to the LEFT or SUBSTRING function.

Thanks in advance.....



Viewing all articles
Browse latest Browse all 23857

Trending Articles



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