June 11, 2009 at 12:18 pm
Hi All,
I am trying to change the value inside of a particular node. The xml is untyped. The following code runs but the value is not changed from true to false. Can somebody please help I'm pulling my hair out.:-)
DECLARE @ConfigXML XML
SELECT @ConfigXML = ConfigXML FROM AffiliateConfig WHERE AffiliateNo = 6 AND AffiliateConfigTypeID = 1
if @ConfigXML.exist('/config/features/image/changenotification/enable') = 1
begin
SET @ConfigXML.modify('
replace value of (/config/features/image/changenotification/enable[1]/text())[1]
with "false"
')
END
Thanks so much!!!
Paul
June 11, 2009 at 12:45 pm
There must be something wrong in your XPath. This works fine:
DECLARE @xml XML
SELECT @xml = N'true'
SET @xml.modify('
replace value of (config/item/enabled/text())[1]
with "false"
')
SELECT @xml
BTW: You don't need the IF part. If your "enabled" item does not exist nothing will be changed.
Flo
June 11, 2009 at 1:01 pm
Thanks so much for your help. I was overlooking something silly.
June 11, 2009 at 1:07 pm
Glad I could help! 🙂
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply