我有這樣的XML在SQL Server表:的XQuery VS的OpenXML在SQL Server
<root>
<meetings>
<meeting>
<id>111</id>
<participants>
<participant><name>Smith</name></participant>
<participant><name>Jones</name></participant>
<participant><name>Brown</name></participant>
</participants>
</meeting>
<meeting>
<id>222</id>
<participants>
<participant><name>White</name></participant>
<participant><name>Bloggs</name></participant>
<participant><name>McDonald</name></participant>
</participants>
</meeting>
</meetings>
</root>
而想要一個結果集是這樣的:
MeetingID Name
111 Smith
111 Jones
111 Brown
222 White
222 Bloggs
222 McDonald
這是很容易使用select from openxml
但我用失敗XQuery的。有人可以幫助我,也可以給任何方法的優點和缺點?
謝謝,正是我所需要的。但我發現openXML語法更易於理解。 – Graeme 2010-08-04 15:09:46
@Graeme:真的嗎?實際上,我發現OpenXML非常不直觀且相當混亂。 – 2010-08-04 15:18:53