sql server xml替换或删除

时间:2013-07-16 18:46:59

标签: xml xquery-sql

使用下表...如果我想用其他东西完全替换xml列的内容,那么替换(或删除/插入)会是什么样子......但是我不需要类似的节点PK我保持完整

CREATE TABLE T (i int, x xml)
go
INSERT INTO T VALUES(1,'<Root>
<ProductDescription ProductID="1" ProductName="Road Bike">
<Features>
 <Warranty>1 year parts and labor</Warranty>enter code here
 <Maintenance>3 year parts and labor extended maintenance is available</Maintenance>
</Features>
</ProductDescription>
/Root>')

1 个答案:

答案 0 :(得分:0)

update t
set x='<Root>
<ProductDescription ProductID="1" ProductName="Road Bike v2">
<Features>
<Warranty>1 year parts and labor</Warranty>enter code here
<Maintenance>3 year parts and labor extended maintenance is available</Maintenance>
</Features>
</ProductDescription>
/Root>'
where i=1