xml & modify() method!

  • Why does the below code not replace the value with 100? Not sure what I'm doing wrong. The value still remains 50 after modify().

    declare @xml xml

    select @xml = '

    '

    set @xml.modify('replace value of (/Test/@value)[1] with "100"')

    select @xml

  • Hi

    Please either mask your xml < and > or attach an example file. 😉

    Greets

    Flo

  • Sorry, missed it!

    Why does the below code not replace the value with 100? Not sure what I'm doing wrong. The value still remains 50 after modify().

    declare @xml xml

    select @xml = '

    '

    set @xml.modify('replace value of (/Test/@value)[1] with "100"')

    select @xml

  • Hi

    Maybe just attach a text file with your sample. 😉

    Greets

    Flo

  • Aah, here's what's to be substituted into @xml.

  • VM (3/24/2009)


    Aah, here's what's to be substituted into @xml.

    Perfect! 🙂

    Try this:

    declare @xml xml

    select @xml = '<Test>

    <value>50</value>

    </Test>'

    set @xml.modify('replace value of (/Test/value/text())[1] with "100"')

    select @xml

    Greets

    Flo

  • Thanks Flo! Perfect! 🙂

Viewing 7 posts - 1 through 6 (of 6 total)

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