add element with a prefix to an existing xml using sql server

  • Hi All

    I have this xml that I need to add element with a prefix. I need to update an existing xml in a BD and this element tag <prefix:Surname> James </prefix:Surname>

    the xml is like this:

    <prefix:Root>

    <prefix:ID>value</prefix:ID>

    <prefix:name>value</prefix:name>

    </prefix:Root>

    I tried using:

    SET @tesxml.modify('insert <prefix:Surname>{sql:variable("@GetValue")}</prefix:Surname> as last into (//*:Root)[1]')

    I get this error:

    XQuery [modify()]: The namespace prefix 'ns3' has not been defined

    Does anyone know how I can fix this.

    Thanx.

  • Yes. Can you show me the complete XML string, including the namespace?

    _________________________________
    seth delconte
    http://sqlkeys.com

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply