[英]TSQL Replace value in XML String
I have a field within my table that contains optional fields of data contained as XML. 我的表中有一个字段,其中包含XML数据的可选字段。
One of those fields is editable in my UI and I am trying to update that node / value within the block of XML. 这些字段之一在我的UI中是可编辑的,我正在尝试在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; 当我保持原样时,它将@updatedEducation
用作字段值; not the actual value of the variable. 不是变量的实际值。
Any way to do this? 有什么办法吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.