I have a string that I want to convert it to XML but it is giving me an error.
<error>A string literal was expected<error>
SET @xmlString = '<OrgStructureRole><SurveyId>13</SurveyId><UserName>xyz13</UserName><UserName>rmn456</UserName><Rule OrgTreeID=131705></Rule><Rule OrgTreeID=131721></Rule></OrgStructureRole>'
I am trying to convert this by using this way.
SELECT convert(xml,@xmlString)
Any suggestions?
I believe it’s failing because the
OrgTreeIDattributes on theRulenodes should be quoted…Giving as an entire line…
If that’s not working, try instead to do a direct assignment…