delete only the root in xml

  • Hi all,

    DECLARE @x XML

    SET @x = ' '

    SET @x.modify('delete /root')

    SELECT @x

    From this example, i want to delete only the root.

    means i except the result like this.

    any idea?

  • Can't see your example, but this works...

    DECLARE @x XML

    SET @x = '<root><a><b /></a><c d="e" /></root>'

    SET @x = @x.query('root/*')

    SELECT @x

    /* Results

    <a><b /></a><c d="e" />

    */

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • Hi Ryan Randall,

    WOW .... Great Man. Thank you very much ... 🙂

  • Nice feedback - thank you 🙂

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

Viewing 4 posts - 1 through 3 (of 3 total)

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