4
這被存儲在一個名爲USERDEF如何在XML列上使用修改替換填充空的XML節點?
<Orders>
<Document>
<DocumentID>abc123</DocumentID>
<ActualShipDate />
<Comments/>
</Document>
<Document>
....
...
</Document>
</Orders>
我試圖填充Comments
元素與此XML類型列我的xml:
declare @t1 table (id bigint, userdef xml)
insert into @t1
select id, userdef from MyMainTable
update @t1
set userdef.modify('replace value of(/Orders/Document/Comments[1]/text())[1] with "NO COMMENTS"')
select * from @t1
不過,我沒有看到Comments
是根本就是人口稠密。爲了實現這個目標,我應該做些什麼改變?
什麼如果我想在INSERT語句中插入一個變量? http://stackoverflow.com/questions/32253235/how-to-use-if-else-statement-to-update-or-create-new-xml-node-entry-in-sql謝謝。 – Si8
謝謝。你是一個拯救生命的人。 – Si8