SQL and XML insert new Node I have an SQL Query to make an XML Document. Everything works except one thing:

A short insert of my SQL Query at this time is:

select OITM.ItemCode, OITM.ItemName, OITM.Price


Output in XML:

&lt;DocumentElement&gt;
  &lt;article&gt;
      &lt;ItemCode&gt;12345&lt;/ItemCode&gt;
      &lt;ItemName&gt;test&lt;/ItemName&gt;
      &lt;Price&gt;20.00&lt;/Price&gt;
  &lt;/article&gt;
&lt;/DocumentElement&gt;


I want this Structure:

&lt;DocumentElement&gt;
      &lt;article&gt;
          &lt;ItemCode&gt;12345&lt;/ItemCode&gt;
          &lt;ItemName&gt;test&lt;/ItemName&gt;
          &lt;Prices&gt;
               &lt;Price&gt;20.00&lt;/Price&gt;
          &lt;/Prices&gt;
      &lt;/article&gt;
    &lt;/DocumentElement&gt;


How can i insert the &lt;Prices&gt; tag?
If you are using FOR XML PATH you can specify nested elements using forward slash (/), like this:

DECLARE @yourTable TABLE (
    ItemCode    INT, 
    ItemName    VARCHAR(10), 
    Price       MONEY
)

INSERT INTO @yourTable VALUES
    ( 12345, 'test', 20 )

SELECT 
    ItemCode, 
    ItemName, 
    Price AS "Prices/Price"
FROM @yourTable
FOR XML PATH('article'), ROOT('DocumentElement'), TYPE