declare @xmlCustomer xml
set @xmlCustomer =' <customer xmlns:C="http://schemas.mybook.com/customerschemas">
<item ID="1">
<customername>北方书城 </customername>
<address>北京市海淀区知春路22号 </address>
<phone>2222222 </phone>
<contact>刘先生 </contact>
</item>
</customer>' -- 删除一个元素
SET @xmlCustomer.modify('
delete /customer/item[@ID=1]/phone
')
SELECT @xmlCustomer
运行结果是: <customer xmlns:C="http://schemas.mybook.com/customerschemas">
<item ID="1">
<customername>北方书城 </customername>
<address>北京市海淀区知春路22号 </address>
<contact>刘先生 </contact>
</item>
</customer>
===============================================
上面是正确的,疑问如下:
<C:customer xmlns:C="http://schemas.mybook.com/customerschemas">
<item ID="1">
<customername>北方书城 </customername>
<address>北京市海淀区知春路22号 </address>
<phone>2222222 </phone>
<contact>刘先生 </contact>
</item>
</C:customer> -- 删除一个元素
SET @xmlCustomer.modify('
delete /C:customer/item[@ID=1]/phone
') 注意红色处是需要修正的! 想要得到上面的运行结果...
等号上下的区别就在于: </C:customer> 和 </customer>这个
set @xmlCustomer =' <customer xmlns:C="http://schemas.mybook.com/customerschemas">
<item ID="1">
<customername>北方书城 </customername>
<address>北京市海淀区知春路22号 </address>
<phone>2222222 </phone>
<contact>刘先生 </contact>
</item>
</customer>' -- 删除一个元素
SET @xmlCustomer.modify('
delete /customer/item[@ID=1]/phone
')
SELECT @xmlCustomer
运行结果是: <customer xmlns:C="http://schemas.mybook.com/customerschemas">
<item ID="1">
<customername>北方书城 </customername>
<address>北京市海淀区知春路22号 </address>
<contact>刘先生 </contact>
</item>
</customer>
===============================================
上面是正确的,疑问如下:
<C:customer xmlns:C="http://schemas.mybook.com/customerschemas">
<item ID="1">
<customername>北方书城 </customername>
<address>北京市海淀区知春路22号 </address>
<phone>2222222 </phone>
<contact>刘先生 </contact>
</item>
</C:customer> -- 删除一个元素
SET @xmlCustomer.modify('
delete /C:customer/item[@ID=1]/phone
') 注意红色处是需要修正的! 想要得到上面的运行结果...
等号上下的区别就在于: </C:customer> 和 </customer>这个
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货