I'm not able to build a correct syntaxt in order to execute any query on my sql sever 2008 related to XML fields.
I've a simple table with fields such as Idproduct, ProductName and XmlProduct. ..And XmlProduct field looks like following:
<DynamicProfile xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/WinTest">
<AllData xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:KeyValueOfstringstring>
<d2p1:Key>MyFirstKey</d2p1:Key>
<d2p1:Value>MyFirstValue</d2p1:Value>
</d2p1:KeyValueOfstringstring>
<d2p1:KeyValueOfstringstring>
<d2p1:Key>MySecondKey</d2p1:Key>
<d2p1:Value>MySecondValue</d2p1:Value>
</d2p1:KeyValueOfstringstring>
</AllData>
</DynamicProfile>
For instance, I need to write a query which extract all rows containing node value to "MySecondKey". How can achieve that?
You can use following TSQL code-->
Here is the ans with xquery operators-->