title: whats wrong in below query Select CONVERT(xml,'<x>' + Replace(A.name,':','</x><x>')+'</x>' ) as xDim from Erecharge;
body: <p>I want to convert string to xml column ..
  I used below query for that :</p>
  
  <pre><code> Select CONVERT(xml,'&lt;x&gt;' + Replace(A.name,':','&lt;/x&gt;&lt;x&gt;')+'&lt;/x&gt;' ) as xDim from Erecharge;
  </code></pre>
  
  <p>but it shows error of incorrect sql syntax.. 
  I want to know whats wrong in above query</p>
  
  <p>I also tried this:</p>
  
  <pre><code> Select Cast('&lt;x&gt;' + Replace(A.name,':','&lt;/x&gt;&lt;x&gt;')+'&lt;/x&gt;' as XML) as xDim from Erecharge;
  </code></pre>