title: FOR XML AUTO, RAW SQL Server
body: <p>I am reading for MS 70-461 exam and when taking a look on a previous test I face the following question:</p>
  
  <p><strong>Question:</strong>
  You need to write a Transact-SQL query that displays all the products received by a singlesupplier in the following XML format:</p>
  
  <pre><code>&lt;Suppliers SupplierID="22" Company="Company Name" ContactNumber="510 250 6400"&gt;
       &lt;Products ProductID="100" UnitPrice="249.00" UnitsInStock="7" /&gt;
       &lt;Products ProductID="118" UnitPrice="559.00" UnitsInStock="12" /&gt;
  &lt;/Suppliers&gt;
  </code></pre>
  
  <p><strong>Correct Answer</strong></p>
  
  <pre><code>SELECT Suppliers.SupplierID, 
         Suppliers.CompanyName AS [Company],
         Suppliers.ContactNumber, 
         Products.ProductID, 
         Products.UnitPrice, 
         Products.UnitsInStock 
  FROM Suppliers
  INNER JOIN Products ON Suppliers.SupplierID = Products.SupplierID 
  WHERE Suppliers.SupplierID = 22 
  FOR XML AUTO, RAW
  </code></pre>
  
  <p>I try to run similar query by using FOR XML AUTO, RAW in SQL server 2012 and SQL Azure and in both cases I receive an error. Is FOR XML AUTO, RAW valid? 
  How should I write the  query in order to return the above XML?</p>
  
  <p>Thank you for your help</p>