title: Parsing nested XML into SQL table
body: <p>What would be the right way to parse the following XML block into SQL Server table according to desired layout (below)? Is it possible to do it with a single SELECT statement, without UNION or a loop? Any takers? Thanks in advance.
  Input XML:</p>
  
  <pre><code>&lt;ObjectData&gt;
    &lt;Parameter1&gt;some value&lt;/Parameter1&gt;
    &lt;Parameter2&gt;other value&lt;/Parameter2&gt;
    &lt;Dates&gt;
      &lt;dateTime&gt;2011-02-01T00:00:00&lt;/dateTime&gt;
      &lt;dateTime&gt;2011-03-01T00:00:00&lt;/dateTime&gt;
      &lt;dateTime&gt;2011-04-01T00:00:00&lt;/dateTime&gt;
    &lt;/Dates&gt;
    &lt;Values&gt;
      &lt;double&gt;0.019974&lt;/double&gt;
      &lt;double&gt;0.005395&lt;/double&gt;
      &lt;double&gt;0.004854&lt;/double&gt;
    &lt;/Values&gt;
    &lt;Description&gt;
      &lt;string&gt;this is row 1&lt;/string&gt;
      &lt;string&gt;this is row 2&lt;/string&gt;
      &lt;string&gt;this is row 3&lt;/string&gt;
    &lt;/Values&gt;
  &lt;/ObjectData&gt;
  </code></pre>
  
  <p>Desired table output:</p>
  
  <pre><code>Parameter1  Parameter2      Dates               Values      Description
  
  Some value  Other value 2011-02-01 00:00:00.0   0.019974    this is row 1
  Some value  Other value 2011-03-01 00:00:00.0   0.005395    this is row 2
  Some value  Other value 2011-04-01 00:00:00.0   0.004854    this is row 3
  </code></pre>
  
  <p>I am after an SELECT SQL statement using OPENXML or xml.nodes() functionality. For example, the following SELECT statement results in production between Values and Dates (that is all permutations of Values and Dates), which is something I want to avoid. </p>
  
  <pre><code>SELECT 
  doc.col.value('Parameter1[1]', 'varchar(20)') Parameter1, 
  doc.col.value('Parameter2[1]', 'varchar(20)') Parameter2, 
  doc1.col.value('.', 'datetime') Dates ,
  doc2.col.value('.', 'float') [Values] 
  FROM 
  @xml.nodes('/ObjectData') doc(col),
  @xml.nodes('/ObjectData/Dates/dateTime') doc1(col),
  @xml.nodes('/ObjectData/Values/double') doc2(col);
  </code></pre>