将此内容的 元素替换为多行中具有
XML
类型的列的新元素:
Replace <apipAccessbility>
element of this content with a new element in multiple rows with a column of type XML
:
<Item title="1234" xmlns="http://www.imsglobal.org/xsd/imsqti_v2p2">
<ItemBody>xyz</ItemBody>
<apipAccessibility xmlns="http://www.imsglobal.org/xsd/apip/apipv1p0/imsapip_qtiv1p0">
<accessibilityInfo>
Blablah
</accessibilityInfo>
</apipAccessibility>
</Item>
一旦元素被更新,它应该是这样的:
Once element is updated it should look like this:
<Item title="1234" xmlns="http://www.imsglobal.org/xsd/imsqti_v2p2">
<ItemBody>xyz</ItemBody>
<apipAccessibility xmlns="http://www.imsglobal.org/xsd/apip/apipv1p0/imsapip_qtiv1p0"/>
</Item>
您可以使用 修改
和删除
:
You could use modify
and delete
:
UPDATE tab
SET col.modify('
declare namespace NS="http://www.imsglobal.org/xsd/imsqti_v2p2";
declare namespace NS2="http://www.imsglobal.org/xsd/apip/apipv1p0/imsapip_qtiv1p0";
delete /NS:Item/NS2:apipAccessibility/*')
-- WHERE id = 1;
LiveDemo
输出:
<Item xmlns="http://www.imsglobal.org/xsd/imsqti_v2p2" title="1234">
<ItemBody>xyz</ItemBody>
<apipAccessibility xmlns="http://www.imsglobal.org/xsd/apip/apipv1p0/imsapip_qtiv1p0" />
</Item>
这篇关于用 SQL 服务器中的新元素替换 XML 元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!