我无法构建正确的syntaxt,以便在我的sql服务器2008上执行与XML字段相关的任何查询。XML字段 - 查询
我有一个简单的表,如Idproduct,ProductName和XmlProduct。 ..和XMLPRODUCT场看起来像以下:
<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>
举例来说,我需要编写一个查询其抽取包含节点的值改为“MySecondKey”的所有行。 如何才能做到这一点?
为什么我需要声明@xmldata变量?这已经存在于我的表xml字段中。另外,有没有使用XQuery的解决方案?像查询,价值,存在的方法..? – bit
与xquery类似的解决方案在这里推荐 - > http://stackoverflow.com/questions/1440848/openxml-with-xmlnsdt – rt2800
请你能给我发一个与我的问题有关的明确例子吗? – bit