Using Microsoft SQL Server Management Studio, I've inserted an element into the xml file and now wish to insert an attribute so it looks like:
<a><b c="2"/></a>
I created b with:
update #tmp
set column.modify('insert <b/> into (/a)[1]')
Now I wish to create c as an attribute of b as shown above. So I try:
update #tmp
set column.modify('insert attribute c{''2''} into (/a/@b)[1]')
But I get the error:
XQuery [#tmp.column.modify()]: The target of 'insert into' must be an element/document node, found 'attribute(b,xdt:untypedAtomic)