Table dbo.table_a contains a XML column foo. Every row has a XML-tree in the a XML-column. Secondary table dbo.table_b contains old value old_val and new value new_val
The XML-tree looks like this
<root>
<Customer>
<Name>ACME</Name>
</Customer>
<Def>
<Enabled>true</Enabled>
<CIds>
<Id>ABC</Id>
<Id>DEF</Id>
</CIds>
</Def>
</root>
Please Note that /root/Def/CIds can contain zero or several child nodes called Id.
dbo.table_b looks like this
+---------+---------+
| old_val | new_val |
+---------+---------+
| ABC | 123 |
| DEF | 456 |
+---------+---------+
I need to replace the value for every Id by joining the current xml node value with dbo.table_b on old_val and replacing the xml node value with new_val. ABC should be replace with 123 and DEF with 456