Thanks in advance for your help! I am trying to write a query on an XML column that is set up as follows:
<DictionaryOfStringObject>
<Item>
<Key>
<string>Info</string>
</Key>
<Value>
<SerializableDictionaryOfStringObject>
<Item>
<Key>
<string>FirstName</string>
</Key>
<Value>
<anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" xmlns:d7p1="http://www.w3.org/2001/XMLSchema-instance" d7p1:type="q1:string">JON</anyType>
</Value>
</Item>
<Item>
<Key>
<string>MiddleName</string>
</Key>
<Value>
<anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" xmlns:d7p1="http://www.w3.org/2001/XMLSchema-instance" d7p1:type="q1:string" />
</Value>
</Item>
<Item>
<Key>
<string>LastName</string>
</Key>
<Value>
<anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" xmlns:d7p1="http://www.w3.org/2001/XMLSchema-instance" d7p1:type="q1:string">SNOW</anyType>
</Value>
</Item>
<Item>
<Key>
<string>Gender</string>
</Key>
<Value>
<anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" xmlns:d7p1="http://www.w3.org/2001/XMLSchema-instance" d7p1:type="q1:string">Male</anyType>
</Value>
</Item>
I need to pull out the information in this column FOR EACH ROW IN THE TABLE. I am not looking for a specific person. I need to extract this information from the column for each row in the table.
I understand querying a single row for a specific person but how can I develop a SELECT statement that will extract this information across the entire table for each row?
Each person is given a row in the Table and an XML column I need to develop a query to run against the table that will extract the information for each person.
Row 1 = FirstName1, LastName1, Gender1
Row 2 = FirstName2, LastName2, Gender2
I have never written a query for tags like this, can someone please assist me in developing a Select statement(s) for SQL Server 2008
and SQL Server 2010
.
I have some XML experience but could use an example and and explanation of how this is achieved.