Update Empty XML Tag in SQL Server

Posted by monO on Stack Overflow See other posts from Stack Overflow or by monO
Published on 2010-05-11T15:34:13Z Indexed on 2010/05/11 15:54 UTC
Read the original article Hit count: 178

Filed under:
|

I'm trying to update an empty XML Tag in my Xml string on sql server; it says the row is updated when i run the following script, but when I view the XML; nothing has changed:

Declare @newValue varchar(100)
select @newValue = '01'

    update dbo.UploadReport
    set XmlTest.insert('replace value of (/CodeFiveReport/Owner/AgencyID/text())[1] with sql:variable("@newValue")') 
    where id = 'myId'

The xml after still appears as this in the databse

<AgencyID />

What am I doing wrong?

I've tried @AgencyID without the text() at the end and still no avail...

© Stack Overflow or respective owner

Related posts about Xml

Related posts about sql