In the query below I’m updating a value in an xml node in the Items column in table X in the database. Right now I’m filtering based only on the Name attribute. Because there are multiple nodes with the same Name I need to be able to filter on more attributes during the update.
UPDATE dbo.Declarations
SET Items.modify('replace value of
(/Items/Item[@Name=(sql:variable("@ItemName"))]/text())[1]
with sql:variable("@Value")')
WHERE DeclarationId = @DeclarationId
END
Is it possible to select an XML node based on multiple attribute values and then update the value of this node?