有没有办法统一以下陈述:
UPDATE @Test
SET [XML].modify('delete (Settings/@attributefordeletion1)[1]')
UPDATE @Test
SET [XML].modify('delete (Settings/@attributefordeletion2)[1]')
UPDATE @Test
SET [XML].modify('delete (Settings/@attributefordeletion3)[1]')
答案 0 :(得分:3)
update @Test
set [XML].modify('delete (
Settings/@attributefordeletion1,
Settings/@attributefordeletion2,
Settings/@attributefordeletion3
)')
或者如果要删除所有属性
update @Test
set [XML].modify('delete Settings/@*')
答案 1 :(得分:1)
发现了删除属性集的另一种方法:
update @Test
set [XML].modify('delete Settings/@*[local-name()=(
"attributefordeletion1",
"attributefordeletion2",
"attributefordeletion3"
]')