title: SQL Server stored procedure to read xml file
body: <p>I have an application where I want to list all the products that matches requested filter category. I can send all the filters from c# code via XML file. my XML file would look like...</p>
  
  <pre><code>&lt;filter CategoryId="" ForHomepage="" StartingIndex=""&gt;
  &lt;brand&gt;
  &lt;id&gt;&lt;/id&gt;
  &lt;id&gt;&lt;/id&gt;
  &lt;/brand&gt;
  &lt;os&gt;
  &lt;id&gt;&lt;/id&gt;
  &lt;id&gt;&lt;/id&gt;
  &lt;/os&gt;
  &lt;touch value="" /&gt;
  &lt;display&gt;
  &lt;id&gt;&lt;/id&gt;
  &lt;id&gt;&lt;/id&gt;
  &lt;/display&gt;
  &lt;ram&gt;
  &lt;id&gt;&lt;/id&gt;
  &lt;id&gt;&lt;/id&gt;
  &lt;/ram&gt;
  &lt;storage&gt;
  &lt;id&gt;&lt;/id&gt;
  &lt;id&gt;&lt;/id&gt;
  &lt;/storage&gt;
  &lt;camera&gt;
  &lt;id&gt;&lt;/id&gt;
  &lt;id&gt;&lt;/id&gt;
  &lt;/camera&gt;
  &lt;battery&gt;
  &lt;id&gt;&lt;/id&gt;
  &lt;id&gt;&lt;/id&gt;
  &lt;/battery&gt;
  &lt;/filter&gt;
  </code></pre>
  
  <p>I can read the XML and store the data in temp table but I want to read categoryid, touch, forhomepage and startingindex fields in variables declared in sp (an not in table because this is non repetitive data).</p>
  
  <p>Can anyone have such issues in past? To store the XML data in declared variables.</p>
  
  <p>Taken from OP's comment:</p>
  
  <pre><code>&lt;filter CategoryId="12" ForHomepage="true" StartingIndex="0"&gt;
    &lt;brand&gt;
      &lt;id&gt;1001&lt;/id&gt;
      &lt;id&gt;1006&lt;/id&gt;
    &lt;/brand&gt;
    &lt;os&gt;
      &lt;id&gt;7005&lt;/id&gt;
      &lt;id&gt;7009&lt;/id&gt;
    &lt;/os&gt;
    &lt;touch value="true" /&gt;
    &lt;display&gt;
      &lt;id&gt;3002&lt;/id&gt;
      &lt;id&gt;3005&lt;/id&gt;
    &lt;/display&gt;
    &lt;ram&gt;
      &lt;id&gt;2006&lt;/id&gt;
      &lt;id&gt;2009&lt;/id&gt;
    &lt;/ram&gt;
    &lt;storage&gt;
      &lt;id&gt;4006&lt;/id&gt;
    &lt;/storage&gt;
    &lt;camera&gt;
      &lt;id&gt;9009&lt;/id&gt;
      &lt;id&gt;9014&lt;/id&gt;
    &lt;/camera&gt;
    &lt;battery&gt;
      &lt;id&gt;1501&lt;/id&gt;
      &lt;id&gt;1581&lt;/id&gt;
    &lt;/battery&gt;
  &lt;/filter&gt;
  </code></pre>