title: Cast FOR XML to Varchar(max)
body: <p>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.</p>
  
  <p>I know from this <a href="https://stackoverflow.com/questions/1761124/how-many-characters-in-varcharmax">post</a> that varchar(max) can have up to 2^31 characters and 1 byte = 1 character, but it seems to be cutting off my data.</p>
  
  <p>Do XML characters count as more than 1 byte? Why am I not able to select all the data from my xml result?</p>
  
  <pre><code>CAST((SELECT COLUMNS FROM TABLE FOR XML PATH('Name'), TYPE) AS VARCHAR(MAX)
  </code></pre>