0

I try to convert this into XML:

DECLARE @xml XML;
SELECT @xml = (SELECT 'xxx' + nchar(0x10) FOR XML PATH('') );

I got error: XML parsing: line 1, character 9, illegal xml character

But this works fine:

SELECT 'xxx' + nchar(0x10) FOR XML PATH('') 

Is there a workaround for this?

On MS Connect nothing useful: https://connect.microsoft.com/SQLServer/feedback/details/547817/xml-type-does-not-accept-all-character-escape-sequences

gethomast
  • 436
  • 1
  • 3
  • 10
  • What xml output are you expecting to get? Note that the stand-alone example, while the query includes a `FOR XML`, *isn't* producing xml output... – AakashM Aug 06 '12 at 10:08
  • I want to save this output to table with data type xml. output is correct "xxx" but can't be saved into db. – gethomast Aug 06 '12 at 10:22

1 Answers1

0

I think you can't use any characters which are not comprised of the current sql server collation to assign to xml variable.

AnandPhadke
  • 13,160
  • 5
  • 26
  • 33