title: How to add attributes to xml nodes in sql server 2005
body: <p>If i wanted to add an attribute to the root element record, can i do this from the sql side?</p>
  
  <pre><code>SELECT top 1 'text' as nodeA
                  from test as z
  FOR XML AUTO, ELEMENTS, root('record')
  </code></pre>
  
  <p>i would like to produce the xml like this:</p>
  
  <pre><code> &lt;Root attribute="value"&gt;
       &lt;z&gt;
           &lt;NodeA&gt;text&lt;/NodeA&gt;
       &lt;/z&gt;
   &lt;/Root&gt;
  </code></pre>