title: sp_xml_preparedocument go with error "Only one top level element is allowed in an XML document"
body: <p>I'am trying to execute sp_xml_preparedocument and geting error "Only one top level element is allowed in an XML document"</p>
  
  <p>my T-SQL commands:</p>
  
  <pre><code>DECLARE @aa XML
  DECLARE @idoc int
  SET @aa =(select * from db_name for xml auto, xmldata) 
  </code></pre>
  
  <hr>
  
  <p>@aa now is</p>
  
  <pre><code>&lt;Schema xmlns="urn:schemas-microsoft-com:xml-data" xmlns:dt="urn:schemas-microsoft-com:datatypes" name="Schema7"&gt;
  &lt;ElementType name="Person" content="empty" model="closed"&gt;
    &lt;AttributeType name="preson_id" dt:type="i4" /&gt;
    &lt;AttributeType name="Name" dt:type="string" /&gt;
    &lt;AttributeType name="Surname" dt:type="string" /&gt;
    &lt;AttributeType name="guid" dt:type="uuid" /&gt;
    &lt;AttributeType name="version" dt:type="bin.base64" /&gt;
    &lt;attribute type="preson_id" /&gt;
    &lt;attribute type="Name" /&gt;
    &lt;attribute type="Surname" /&gt;
    &lt;attribute type="guid" /&gt;
    &lt;attribute type="version" /&gt;
   &lt;/ElementType&gt;
  &lt;/Schema&gt;
    &lt;Person xmlns="x-schema:#Schema7" preson_id="1" Name="Иван" Surname="Иванов" guid="2E739E87-3CA4-4ED8-ADD0-8B59957668B8" version="AAAAAAAAB9E=" /&gt;
    &lt;Person xmlns="x-schema:#Schema7" preson_id="2" Name="Николай" Surname="Николаев" guid="BDC41C59-D70F-4B70-954E-4918B9516AF8" version="AAAAAAAAB9I=" /&gt;
    &lt;Person xmlns="x-schema:#Schema7" preson_id="3" Name="Максим" Surname="Максимов" guid="740E57F3-56BA-48B8-92AF-978D7B1D2712" version="AAAAAAAAB9M=" /&gt;
  </code></pre>
  
  <hr>
  
  <pre><code>EXEC sp_xml_preparedocument @idoc OUTPUT, @aa
  </code></pre>
  
  <hr>
  
  <pre><code>The XML parse error 0xc00ce555 occurred on line number 1, near the XML text ""
  Msg 6602, Level 16, State 2, Procedure sp_xml_preparedocument, Line 1
  The error description is 'Only one top level element is allowed in an XML document
  </code></pre>
  
  <hr>
  
  <p>I'am new in this, and i need help)))
  An one more question - How parse timestamp type?</p>
  
  <p>if i use </p>
  
  <pre><code>SET @aa =(select * from db_name for xml elements, root('root'), type) 
  </code></pre>
  
  <p>sp_xml_preparedocument works fine, OPENXML returns all values of my db_table, but timestamp values looks not the same as were..</p>
  
  <p>Sorry for my bad English </p>