我無法構建正確的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