Dear Experts,
I have a XML as follows
<items>
<item key = "some text1" value = "some text1" />
<item key = "some text2" value = "some text2" />
</items>
Now i want to Replace Text1 with new text else.
I am using below but didn't help to replace it
declare @x xml
declare @oldvalue nvarchar(20) = "some text1"
Declare @newvalue nvarchar(20) = "NewText"
select @x = xmldata from table;
set @x = @x.modify(' /items/item[@key=sql:variable("@oldvalue")]/key/text()[1]
with (sql:variable("@newvalue"))
')
Not sure what i am missing ... is it possible to replace Key /Values in the XML elements, if yes any help would be helpful
Thanks
Thank you... MOMEN