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)
 How to rename xml node name in XML COLUMN

Author  Topic 

Mindscape
Starting Member

5 Posts

Posted - 2007-04-25 : 09:50:14
Hi ,I am able to insert , delete nodes from a xml data in Xml Column.But I am not able to update an existing node name.
And I need to learn how .

My data is as shown below.The name of the table is alldata and the xml type column name is TumBilgiler.

<restaurants>
<restaurant numara="6">
<Nusret>test</Nusret>
<isim>Restaurant Menekþe</isim>
<TEL>02122584512</TEL>
<SEMT>FATIH</SEMT>
<ADRES>ISTANBUL</ADRES>
<ADRES1>ISTANBUL</ADRES1>
</restaurant>
</restaurants>

I am pasting the delete and insert ways of nodes below
--DELETE--Deletes the node name Nusret.
UPDATE
Alldata
SET
Tumbilgiler.modify('delete /restaurants/restaurant/Nusret[1]')
where
CATID = 1

--INSERT--Inserts a new node named Nusret
UPDATE
Alldata
SET
Tumbilgiler.modify('insert <Nusret>test</Nusret> as last into (/restaurants/restaurant)[1]')
WHERE
CATID = 1

So , How can I rename the node Nusret ?

Thanks ...
   

- Advertisement -