Cast FOR XML to Varchar(max) [duplicate]
问题 This question already has an answer here : For XML length limitation (1 answer) Closed 6 years ago . I have a query that returns XML which I want to convert to varchar. My query returns 93,643 characters of XML. When I try to cast my xml result as varchar, I only get 43,679 characters when I copy the result set to a text editor. When I do len(xmlString), I get 93,643 characters. I know from this post that varchar(max) can have up to 2^31 characters and 1 byte = 1 character, but it seems to be