本文介紹了一次更新sql server xml數據字段上的多個屬性的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
限時送ChatGPT賬號..
是否可以在一次更新中修改單個節點上的多個屬性?
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數據字段上的多個屬性的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!