I am attempting to add an attribute to a node in an XML column in SQL Server.
UPDATE
TableName
SET Metadata.modify('
insert attribute MyAttribute{"01b9cd0b-bfed-436f-bc58-57d2fddd9211"}
into (Root/Collection/Item[@No="360"][1])
')
WHERE
TableName.Id = 1
I get the following error...
Msg 2226, Level 16, State 1, Line 4 XQuery
[TableName.Metadata.modify()]: The target of 'insert' must be a single node, found 'element(Item,xdt:untyped) *'
But I thought my selection would return a single item, given the [1]