sql-serverxmlencoding

sp_xml_preparedocument: how to change SQL xml encoding


sp_xml_preparedocument accepts an local variable declared as varchar(max) and set to xml received without xml declaration.

Default encoding is then set to UTF-8 I suppose.

When I try to change it to something like UTF-16 message

Switch from current encoding to specified encoding not supported.

If I leave it on default message

An invalid character was found in text content.

is shown.

Any suggestion?

Thx


Solution

  • I changed

    varchar(max)

    to

    nvarchar(max)

    and it works now...