Re: modify() Top-level attribute nodes are not supported Error



Hello BradR,

The sql:variable() function is what you'd need to resolve @xUpdate in your query (remember that @xUpdate is an attribute in XQuery). That said, if you try this:

set @xPerson.modify('insert sql:variable("@xUpdate") into /person[1]')

You'll be sadly disappointed. You can't use the sql:variable function to inject XML into XML. And converting xUpdate to nvarchar(...) isn't going to help you either for less obvious reasons.

IMHO don't use XMLDML for this, its just too much of a PITA. You're better off you write a SQLCLR function that does the insert for you.

Your milage may vary.

Thanks!
Kent Tegels
DevelopMentor
http://staff.develop.com/ktegels/


.



Relevant Pages

  • Re: Native Xml Databases
    ... How do they compare with ordinary dbs? ... if you can do you process with XQuery, XPath and XUpdate you might consider to use it. ...
    (comp.lang.java.databases)
  • Re: modify() Top-level attribute nodes are not supported Error
    ... The sql:variablefunction is what you'd need to resolve @xUpdate in your ... query (remember that @xUpdate is an attribute in XQuery). ... inject XML into XML. ... off you write a SQLCLR function that does the insert for you. ...
    (microsoft.public.sqlserver.xml)

Loading