I have a table (on sqlserver05) with an xml column. The format of the column is similar to this:
<doc>
<field name="a">foo</field>
<field name="b">bar</field>
<field name="c">fizz</field>
<field name="d">buzz</field>
</doc>
I would like to copy a subset of that xml to a new xml column, for instance:
<doc>
<field name="a">foo</field>
<field name="c">fizz</field>
</doc>
How can I do so?
EDIT: this is what worked for me (based on the accepted answer)
UPDATE tbl
SET xml_SubColumn =
xml_Column.query('<doc>{//field[@name="a" or @name="c"]}</doc>')