title: t-sql: convert varchar to xml
body: <p>I have some valid and invalid xml values stored in a varchar column.</p>
  
  <p>I'd like to cast the valid xml values to the actual xml data type and invalid to nulls.</p>
  
  <p>What's a good way to do this ?</p>
  
  <p>Something like:</p>
  
  <pre><code>SELECT 
      CASE WHEN dbo.isValidXML(xml_data) THEN CAST(xml_data as XML)
      ELSE null 
  END
  </code></pre>