我有一张 table :
MyTable
config as XML
title as varchar(255)
在 MyTable.config 中,我有以下结构的 XML:
<configuration pagetitle="myConfig">
<column>
<row>
<component id="1" type="MyPiece" title="My Title" text="junk" />
</row>
</column>
</configuration>
我需要一个脚本来将 MyTable.text 的值注入(inject)到我的配置 XML 中组件节点的文本属性中。
我知道这是错误的,但我想做类似的事情:
UPDATE MyTable SET config.configuration.column.row.component.title = title
最佳答案
UPDATE MyTable
SET Config.modify('
replace value of (/configuration/column/row/component/@title)[1]
with sql:column("title")
')
关于sql - 使用 XQUERY/Modify 将我的一段 XML 替换为来自 varchar 字段的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/276009/