title: Selecting column containing XML into FOR XML query
body: <p>I have a temporary table that has a column 'Header' that contains XML, that looks something like this:</p>
  
  <pre><code>&lt;Header&gt;
      &lt;RecordID&gt;Value&lt;/RecordID&gt;
      &lt;CompanyCode&gt;Value&lt;/CompanyCode&gt;
  &lt;/Header&gt;
  </code></pre>
  
  <p>I am then selecting that temp table column into a FOR XML query, that looks like this:</p>
  
  <pre class="lang-sql prettyprint-override"><code>SELECT
      Header
  FROM
      #TempTable
  FOR XML PATH ('Asn'), ROOT ('Ans'), ELEMENTS 
  </code></pre>
  
  <p>However, this doubles up the header node, and results in an XML that looks like this:</p>
  
  <pre><code>&lt;Ans&gt;
    &lt;Asn&gt;
      &lt;Header&gt;&amp;lt;Header&amp;gt;&amp;lt;RecordID&amp;gt;value&amp;lt;/RecordID&amp;gt;&amp;lt;CompanyCode&amp;gt;value&amp;lt;/CompanyCode&amp;gt;&amp;lt;&amp;lt;/Header&amp;gt;&lt;/Header&gt;
    &lt;/Asn&gt;
  &lt;/Asns&gt;
  </code></pre>
  
  <p>How can I stop the header tag from doubling up when I select it into my XML query?</p>