title: What does Tab(Col) mean in t-sql?
body: <p>I needed to create a table from XML in Microsoft SQL Server Management 2008. The following creates the table that I need, however I do not know what Tab(Col) does. The table and xml are simplified for examples sake. Can someone please explain to me what Tab(Col) is doing? Thanks</p>
  
  <p><strong>NOTE: This is working as it is. Just need a conceptual explanation.</strong></p>
  
  <pre><code>DECLARE @xml XML
  SET @xml = '&lt;Root&gt;
                 &lt;Order&gt;
                    &lt;customer_id&gt; 1 &lt;/customer_id&gt;
                    &lt;credit&gt; 1.03 &lt;/credit&gt;
                 &lt;/Order&gt;
                 &lt;Order&gt;                 
                    &lt;customer_id&gt; 2 &lt;/customer_id&gt;
                    &lt;credit&gt; 1500585412.02 &lt;/credit&gt;
                 &lt;/Order&gt;
                 &lt;Order&gt;
                    &lt;customer_id&gt; 3 &lt;/customer_id&gt;
                    &lt;credit&gt; 10.25 &lt;/credit&gt;
                 &lt;/Order&gt;
              &lt;Root&gt;'
  
  SELECT tab.col.value('customer_id[1]','INT') as customer_id,
         tab.col.value('credit[1]','MONEY') as credit
  INTO #temp_order
  FROM @xml.nodes('/Root/Order') Tab(Col)
  
  SELECT * FROM #temp_order
  </code></pre>
  
  <p>This will create the table #temp_order:</p>
  
  <pre><code>customer_id  | credit
               |
            1  | 1.03 
            2  | 1500585412.02 
            3  | 10.25 
  </code></pre>