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

[SQL 2012] split string with forbidden characters

$
0
0

Hi all,

I have an issue with a query

I would like to find an equivalent of pivot function, but with a column that contains forbidden characters (like []&) and using delimiter (,), and when number of value on column could be different :

colA              colB                   colC
toto              titi                     [valeur].[membre].&[test1],[valeur].[membre].&[test2],[valeur].[membre].&[test3]
tata              tutu                   [valeur].[membre].&[test4],[valeur].[membre].&[test5]
fifi                fafa                    [valeur].[membre].&[test6]
fofo              fufu                    [valeur].[membre].&[test7],[valeur].[membre].&[test7],[valeur].[membre].&[test9]

what should give :

colA              colB                   colC
toto              titi                     [valeur].[membre].&[test1]
toto              titi                     [valeur].[membre].&[test2]
toto              titi                     [valeur].[membre].&[test3]
tata              tutu                   [valeur].[membre].&[test4]
tata              tutu                   [valeur].[membre].&[test5]
fifi                fafa                    [valeur].[membre].&[test6]
fofo              fufu                    [valeur].[membre].&[test7]
fofo              fufu                    [valeur].[membre].&[test8]
fofo              fufu                    [valeur].[membre].&[test9]



I try with splitstring function, xml path, but nothing works.

Thanks in advance.

Xavier


Viewing all articles
Browse latest Browse all 23857

Trending Articles



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