title: How to query on XML column In SQL Server 2008
body: <p>I am using SQL Server 2008</p>
  
  <p>I have a table with xml data looks like:</p>
  
  <pre><code>ID           xml_col  
  1            &lt;Attribute id="7"&gt;1.0&lt;/Attribute&gt;&lt;Attribute id="8"&gt;AAA&lt;/Attribute&gt;  
  2            &lt;Attribute id="7"&gt;2.0&lt;/Attribute&gt;&lt;Attribute id="8"&gt;BBB&lt;/Attribute&gt;  
  3            &lt;Attribute id="7"&gt;3.0&lt;/Attribute&gt;&lt;Attribute id="8"&gt;AAA&lt;/Attribute&gt;  
  4            &lt;Attribute id="7"&gt;1.0&lt;/Attribute&gt;&lt;Attribute id="8"&gt;BBB&lt;/Attribute&gt;  
  5            &lt;Attribute id="7"&gt;1.0&lt;/Attribute&gt;&lt;Attribute id="8"&gt;AAA&lt;/Attribute&gt;  
  6            &lt;Attribute id="7"&gt;7.0&lt;/Attribute&gt;&lt;Attribute id="8"&gt;CCC&lt;/Attribute&gt;  
  </code></pre>
  
  <p>I want to get those records that </p>
  
  <pre><code>'when attribute=17 then value =1'+ 'when attribute=8 then value='AAA''
  </code></pre>
  
  <p>How can i create the query and how to build xml indexes?</p>
  
  <p>Thank you very much.</p>