title: Invalid XML in a varbinary(max) column in SQL Server 2005
body: <p>So I got a <code>varbinary(max)</code> column in SQL Server 2005 and it's full of XML. A few records somewhere have truncated XML so they're invalid.</p>
  
  <p>This means if I run a </p>
  
  <pre><code>SELECT CAST(myVarbinaryColumn as XML) ... 
  </code></pre>
  
  <p>it blows chunks.</p>
  
  <p>How can I filter out/skip invalid xml ?</p>
  
  <p>When I've done similar with a varchar that supposedly has dates I could use <code>ISDATE(blah) = 1</code>. So an equivalent <code>ISVALIDXML()</code> would be nice.</p>
  
  <p>Please don't comment about "Why isn't the column XML datatype anyway.." This happened in the past and I don't have a time machine.</p>