title: What type is returned from nodes() in a SQL Server XML query
body: <p>If I have a SQL variable of the XML type, it's possible to use it directly as a column of the SELECT clause (even if the value is an XML fragment without a single root element)</p>
  <pre><code>DECLARE @Items XML
  SET @Items = '&lt;item&gt;one&lt;/item&gt;&lt;item&gt;two&lt;/item&gt;'
  SELECT @Items
  </code></pre>
  <p>Yet when I shred that XML variable in any way using the <code>nodes()</code> function, SQL Server complains that</p>
  <pre><code>SELECT Items.Item FROM @Items.nodes('/') AS Items (Item)
  -- The column 'Item' that was returned from the nodes() method cannot be used directly. It can only be used with one of the four XML data type methods, exist(), nodes(), query(), and value(), or in IS NULL and IS NOT NULL checks.
  </code></pre>
  <p>It's fine when I follow the hints contained in the error message</p>
  <pre><code>SELECT Items.Item.query('.') FROM @Items.nodes('/') AS Items (Item)
  SELECT Items.Item.query('.') FROM @Items.nodes('//item') AS Items (Item)
  </code></pre>
  <p>But I can't even convert the result back to XML without using one of those &quot;XML data type&quot; methods.</p>
  <pre><code>SELECT CAST(Items.Item AS XML) FROM @Items.nodes('/') AS Items (Item)
  -- The column that was returned from the nodes() method cannot be converted to the data type xml. It can only be used with one of the four XML data type methods, exist(), nodes(), query(), and value(), or in IS NULL and IS NOT NULL checks.
  </code></pre>
  <p>What is the data type of the <code>Items.Item</code> column and why can't I use it as XML without involving additional methods ( when it's clearly possible to directly select a column of the XML data type?)</p>