是否可以在一次更新中修改单个节点上的多个属性?
Is it possible to modify multiple attributes on a single node within one Update?
我有类似的东西:
<ENTITY NAME="entity1">
<ATTR ID="attr1" CAPTION="Attributes to Change" SIZE="100" WIDTH="100"></ATTR>
</ENTITY>
我已经能够使用三个单独的更新来修改 CAPTION、SIZE 和 WIDTH 属性,但是我一直在寻找将它们组合成单个更新的方法,但徒劳无功.可能吗?
I've been able to use three separate Updates to modify the CAPTION, SIZE, and WIDTH attributes, but I've looked in vain for some way to combine them into a single Update. Is it possible?
我使用过的更新示例:
UPDATE t
SET [column_name].modify('replace value of (/ENTITY/ATTR/@CAPTION)[1] with "New Attribute Caption"')
FROM table t
UPDATE t
SET [column_name].modify('replace value of (/ENTITY/ATTR/@SIZE)[1] with "200"')
FROM table t
UPDATE t
SET [column_name].modify('replace value of (/ENTITY/ATTR/@WIDTH)[1] with "200"')
FROM table t
不,这是不可能的.
来自 替换 (XML DML) 的值.
表达式1
标识要更新其值的节点.它必须仅识别单个节点.也就是说,Expression1 必须是一个静态的单身.
Expression1
Identifies a node whose value is to be updated. It must identify only a single node. That is, Expression1 must be a statical singleton.
这篇关于一次更新sql server xml数据字段上的多个属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!