Hi,
I am trying to run this script which parse a row value into multiple column by ','
SELECT X.I.value('p[1]', 'varchar(MAX)') AS [OutreachActivity_1], X.I.value('p[2]', 'varchar(MAX)') AS OutreachActivity_2, X.I.value('p[3]', 'varchar(MAX)') AS OutreachActivity_3, X.I.value('p[4]', 'varchar(MAX)') AS OutreachActivity_4 FROM (SELECT [XML] = CONVERT(XML, '<i><p>'+ Replace(OutreachActivity, ',', '</p><p>')+ '</p></i>').query('.'), OutreachActivity FROM #TEMP) AS A CROSS APPLY [Xml].nodes('i') AS X(I)
Now it worked pretty well until I got special character like '&' in that column value and start getting an error which says XML can't do character 73!
Please help.
ANK HIT - if reply helps, please mark it as ANSWER or helpful post