January 21, 2011 at 5:26 pm
I need to update the File1 Value field but I not sure how to do the syntax.
DECLARE @XmlData xml
SET @XmlData =
'<ParameterValues>
<ParameterValue>
<Name>File1</Name>
<Value>MyFile1.txt</Value>
</ParameterValue>
<ParameterValue>
<Name>File2</Name>
<Value>MyFile2.txt</Value>
</ParameterValue>
</ParameterValues>'
DECLARE @NewValue varchar(50)
SET @NewValue = 'MyFileNew.txt'
SELECT @XmlData.query('/ParameterValues/ParameterValue[Name="File1"]/Value[1]/text()')
SELECT @XmlData.modify('replace value of (/ParameterValues/ParameterValue[Name="File1"]/Value[1]/text())[1] with sql:variable("@NewValue")')
SELECT @XmlData
Any help would be appreciated
Tim
January 23, 2011 at 1:10 pm
Change
SELECT @XmlData.modify
to
SET @XmlData.modify
N 56°04'39.16"
E 12°55'05.25"
January 23, 2011 at 9:02 pm
and I thought the XPATH stuff was the hard part
Thanks
Tim
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply