Note that there are some explanatory texts on larger screens.

plurals
  1. POXML Data Type In SQL Server 2008 Query
    primarykey
    data
    text
    <p>I have a table in SQL Server in which one of the columns is an XML Datatype. There are other columns in the table that are not XML. Here is an example of the XML that is stored in the column:</p> <pre><code>&lt;AdultAsthma&gt; &lt;Group&gt; &lt;Question text="Act Score:" ForeColor="Green" /&gt; &lt;Controls&gt; &lt;Control type="Label" id="txtScore" text="Enter ACT Score:" ForeColor="Black" /&gt; &lt;Control type="TextBox" id="txtActScore" Answer="" /&gt; &lt;/Controls&gt; &lt;/Group&gt; &lt;/AdultAsthma&gt; </code></pre> <p>What I want is a query that matches some values on the other columns in the table and for those columns that match, I want to get the text attribute from the Question Node and the Answer attribute from the Control node. Can someone help me with this?</p> <p><strong>EDIT</strong></p> <p>What needs to be changed if I have more than one Group node? In this scenerio, I would want the text of each question and the answer to go along with each question. See below:</p> <pre><code>&lt;AdultAsthma&gt; &lt;Group&gt; &lt;Question text="Act Score:" ForeColor="Green" /&gt; &lt;Controls&gt; &lt;Control type="Label" id="txtScore" text="Enter ACT Score:" ForeColor="Black" /&gt; &lt;Control type="TextBox" id="txtActScore" Answer="" /&gt; &lt;/Controls&gt; &lt;/Group&gt; &lt;Group&gt; &lt;Question text="Do You Have Asthma?:" ForeColor="Black" /&gt; &lt;Controls&gt; &lt;Control type="RadioButton" id="rbHaveAsthmaYes" text="Yes" GroupName="Diagnosed" ForeColor="Black" Answer="False" /&gt; &lt;Control type="RadioButton" id="rbHaveAsthmaNo" text="No" GroupName="Diagnosed" ForeColor="Black" Answer="False" /&gt; &lt;/Controls&gt; &lt;/Group&gt; &lt;/AdultAsthma&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload