title: Read XML document stored in SQL Server 2008 R2 with XML datatype
body: <p>I am using SQL Server 2008 R2 and ASP.NET 3.5. I am storing Data table (.NET) at SQL side in XML Form. Column has data type XML.</p>
  
  <p>This is an example of the XML being stored in the SQL Server in a table column.</p>
  
  <pre><code>&lt;container&gt;
  &lt;NewDataSet&gt;
  
  &lt;Containers&gt;
    &lt;BARCODE&gt;680812&lt;/BARCODE&gt;
    &lt;CATEGORYID&gt;114&lt;/CATEGORYID&gt;
    &lt;NAME&gt;KS000147&lt;/NAME&gt;
    &lt;GWT&gt;4.640&lt;/GWT&gt;
    &lt;NWT&gt;4.640&lt;/NWT&gt;
    &lt;LAM&gt;30.00&lt;/LAM&gt;
    &lt;QTY&gt;2&lt;/QTY&gt;
    &lt;QUANTITY&gt;1&lt;/QUANTITY&gt;
    &lt;REMARKS&gt;HM&lt;/REMARKS&gt;
  &lt;/Containers&gt;
  &lt;Containers&gt;
    &lt;BARCODE&gt;680813&lt;/BARCODE&gt;
    &lt;CATEGORYID&gt;114&lt;/CATEGORYID&gt;
    &lt;NAME&gt;KS000147&lt;/NAME&gt;
    &lt;GWT&gt;4.680&lt;/GWT&gt;
    &lt;NWT&gt;4.680&lt;/NWT&gt;
    &lt;LAM&gt;30.00&lt;/LAM&gt;
    &lt;QTY&gt;2&lt;/QTY&gt;
    &lt;QUANTITY&gt;1&lt;/QUANTITY&gt;
    &lt;REMARKS&gt;HM&lt;/REMARKS&gt;
  &lt;/Containers&gt;
  &lt;Containers&gt;
    &lt;BARCODE&gt;680814&lt;/BARCODE&gt;
    &lt;CATEGORYID&gt;114&lt;/CATEGORYID&gt;
    &lt;NAME&gt;KS000147&lt;/NAME&gt;
    &lt;GWT&gt;4.490&lt;/GWT&gt;
    &lt;NWT&gt;4.490&lt;/NWT&gt;
    &lt;LAM&gt;30.00&lt;/LAM&gt;
    &lt;QTY&gt;2&lt;/QTY&gt;
    &lt;QUANTITY&gt;1&lt;/QUANTITY&gt;
    &lt;REMARKS&gt;HM&lt;/REMARKS&gt;
  &lt;/Containers&gt;
  &lt;/NewDataSet&gt;
  &lt;/container&gt;
  </code></pre>
  
  <p>Now I want to fetch this XML in a tabluar form. How do I write the query in SQL to fetch XML in following tabular format?  i.e.</p>
  
  <pre><code>BARCODE | CATEGORYID |NAME     |GWT   |NWT   |LAM   |QTY |QUANTITY |REMARKS 
  680814  |    114     |KS000147 |4.490 |4.490 |30.00 | 2  |   1     |HM
  </code></pre>
  
  <p>Let me know if you need more detail.</p>