I have a column in a table that contains xml that looks like the following
<memberHours type="TeamHours[]">
<item>
<member type="String">Bill</member>
<hours type="Decimal">0.0</hours>
</item>
<item>
<member type="String">John</member>
<hours type="Decimal">0.0</hours>
</item>
<item>
<member type="String">Sally</member>
<hours type="Decimal">0.0</hours>
</item>
</memberHours>
I need to be able to find all of the rows where the member is equal to 'John' and then replace 'John' with 'Jon'. Since my xml is stored in an nvarchar(max) column, I am writing a function that casts the column to an xml variable that I can then use. What I cannot figure out is how to find which 'Item' matches and how to replace just that one value (i.e. just 'John')
I am on SQL server 2008.