Home Forums SQL Server 2008 T-SQL (SS2K8) How can I add encoding in output XML file like "<?xml version="1.0" encoding="ISO-8859-1"?>" RE: How can I add encoding in output XML file like "<?xml version="1.0" encoding="ISO-8859-1"?>"

  • You're quite welcome...

    Jim88 (12/13/2013)


    No, it would not work because it inside the root. This XML has to be outside the root.

    Actually the previous idea was good. I could make it to work perfectly.

    SELECT replace (replace ((SELECT ('<?xml version="1.0" encoding="iso8859-1"?>')

    for xml path ( ('')) , '<','<') ,'>', '>')

    UNION ALL

    select (Select doc.col1, doc.col2, doc.col3

    from TestTable as doc for xml path ('doc') )

    It would generate 2 records in the XML file but it's perfect when use an XML editor to open it. It resolved my issue that XML file contains double byte chars.

    Thanks for the great idea Steve!

    Jimmy

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)