Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 modify XML data

Author  Topic 

chetanb3
Yak Posting Veteran

52 Posts

Posted - 2008-09-24 : 08:54:13
Hi All,
I have table XMLDataTable contain following two records,

Id Name Address
------------------------------------------------------------
1 Chetan <Address><city>Pune</city><Street>Nagar Road</Street></Address>
2 Chetan <Address><city>Pune</city><Street>Nagar

I want to update the value of node <city>,
I am using below query, but i think i m missing something..

UPDATE XMLDataTable
SET Address.modify('replace value of (/Address/city)[1] with "Mumbai"')
WHERE ID=1

ayamas
Aged Yak Warrior

552 Posts

Posted - 2008-09-24 : 10:32:35
Try replace value of (/Address/city/text())[1]
Go to Top of Page

chetanb3
Yak Posting Veteran

52 Posts

Posted - 2008-09-25 : 01:57:41
Thanks. It works for me.
Go to Top of Page
   

- Advertisement -