Just want to ask for help. I'm trying to split delimited values with a semicolon as a delimiter. Comma cannot be replaced to the semicolon since there are values that have comma.
ID   Value
1   | A&B;C;D;E, F
Transform to:
ID   Value
1    A&B
1    C
1    D
1    E, F
I tried tweaking the SQL scripts that i got online but to no success
SELECT F1.ID,
 O.splitdata 
FROM
 (
 SELECT OldID,
 cast('<X>'+replace((SELECT ColumnName + '' FOR XML PATH('')),';','</X><X>')+'</X>' as XML) as xmlfilter from TableName F
 )F1
 CROSS APPLY
 ( 
 SELECT fdata.D.value('.','varchar(max)') as splitdata 
 FROM f1.xmlfilter.nodes('X') as fdata(D)) O
It works for some of my columns but if the columns have special or Illegal characters it outputs this error:
Msg 9411, Level 16, State 1, Line 2
XML parsing: line 1, character 16, semicolon expected
Thanks!
 
     
     
     
    