Different VARCHAR output under SQL2016

  • Our application recently upgraded to SQL2016 from SQL2008.  We store text data that users have entered in the application.  When we export this data we write it as an XML string.  We also send the data to Excel files using a simple conversion from a DataTable to Excel using a third-party tool called closed XML.  We've noticed an issue.  It seems that new-line and tab characters (and others) are now coming out of the DB in the format of 

    In this format the XML and Excel (backed by XML) complain that these are invalid characters.

    Is there a cast or conversion or collation that can fix this?  Did the default collation change in 2016?  Could it be the DB driver under Windows 2016 (also upgraded).

    Thanks for any help

    ST

  • In looking at it further I think I'm barking up the wrong tree.

     

    Thanks

  • souLTower wrote:

    In looking at it further I think I'm barking up the wrong tree.   Thanks

    How so?

    My suggestion was going to be to first question as to why such special characters exist in the data to begin with and, if they're actually required, to use the TYPE hint in the XML to de-entitize the special characters.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply