2013-07-16 4 views
0

아래 표를 참조하십시오. xml 열의 내용을 완전히 다른 것으로 바꾸려면 다음과 같이 대체 (또는 삭제/삽입) 할 수 있습니다. 일반적인 노드하지만 난 내가sql server xml 교체 또는 삭제

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>') 

답변

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 
+0

네 당신이 그와 같은 XML 데이터 형식을 업데이트 할 수 없습니다 ... 당신이 게시하기 전에 답변을 시도 않았다 그대로 유지하기 위해 PK를해야합니까? – Bayrat