• In light of the other posts, this is just to clarify a comment you made in your article. You stated, "the first character is removed and then converted into an XML documnet." The subsequent code line was:

    SELECT @XML = CAST(REPLACE(@VarXML,CHAR(0),'') AS XML)

    However, the CHAR(0) does not replace the first character, but defines an ASCII 000 character, sometimes referred to as a NULL (not associated with a SQL NULL value) or end-of-document character.

    Thus, this line of code is replacing an ASCII 0 with an empty string character (which is probably located at the end of the string, not the first character.