I have a field within my table that contains optional fields of data contained as XML.
One of those fields is editable in my UI and I am trying to update that node / value within the block of XML.
Here is what I have:
UPDATE dbo.TFS_Feedback_New
SET Details.modify('replace value of (/optional/educational/text())[1] with "@updatedEducation"')
WHERE feedbackID = @FBID
The issue is, I need to pass the replacement as a variable. When I have it as is, it puts in @updatedEducation
as the field value; not the actual value of the variable.
Any way to do this?
You were almost there, only needed to wrap it inside sql:variable()
:
UPDATE dbo.TFS_Feedback_New
SET Details.modify('
replace value of (/optional/educational/text())[1]
with sql:variable("@updatedEducation")')
WHERE feedbackID = @FBID
Documentation on MSDN
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.