title: sql select data from XML param
body: <p>whats the SQL for selecting the values from this XML chunk like done in the sample below?</p>
  
  <pre><code>&lt;RWFCriteria reportType="OPRAProject"&gt;
     &lt;item id="88" name="" value="" type="Project" /&gt;
     &lt;item id="112" name="" value="12" type="Milestone" /&gt;
     &lt;item id="43" name="" value="11" type="Milestone" /&gt;
  &lt;/RWFCriteria&gt;
  </code></pre>
  
  <p>i want to select out similar to this but with the above XML data</p>
  
  <pre><code>DECLARE @Param XML  
  SET @Param = '&lt;data&gt;  
        &lt;release id="1"&gt;&lt;milestone id="1" /&gt;&lt;milestone id="2" /&gt;&lt;/release&gt;  
        &lt;release id="3"&gt;&lt;milestone id="1" /&gt;&lt;milestone id="27"/&gt;&lt;/release&gt;  
      &lt;/data&gt;'  
  
  SELECT c.value('../@id', 'INT') AS ReleaseId, c.value('@id', 'INT') AS MilestoneId  
   FROM @Param.nodes('/data/release/milestone') AS T(c)
  </code></pre>
  
  <p>I want only the data in the nodes where type="Milestone"</p>