Home Forums Programming XML XQuery insert new node RE: XQuery insert new node

  • Thank you.

    Is there a way to replace A2 with something so that it is not hard-coded?

    SET @TXML.modify('insert sql:variable("@NXML") after (/Attribute/A2)[1]');

    No guarantees that A2 node will exist as they are optional. In this case A3 would go after A1 (or before A4). Producing:

    A1

    A3

    A4