Sql 如何更新xml列中的特定节点
我的表[fixed_width_export_specification_t][specification_xml]中存储了以下数据Sql 如何更新xml列中的特定节点,sql,sql-server,tsql,xquery,xquery-sql,Sql,Sql Server,Tsql,Xquery,Xquery Sql,我的表[fixed_width_export_specification_t][specification_xml]中存储了以下数据 <fixed_width_metadata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <fixed_width_metadata_row> <rowtype>sys_header</rowtype> <dbname>s
<fixed_width_metadata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<fixed_width_metadata_row>
<rowtype>sys_header</rowtype>
<dbname>sys_nm_label</dbname>
<width>56</width>
<fillleftright>right</fillleftright>
</fixed_width_metadata_row>
<fixed_width_metadata_row>
<rowtype>remit1</rowtype>
<dbname>remit_column1</dbname>
<width>32</width>
<fillleftright>right</fillleftright>
</fixed_width_metadata_row>
</fixed_width_metadata>
系统头
系统nm标签
56
正确的
汇款1
汇款单第1栏
32
正确的
我想将rowtype等于remote1,dbname等于remote_column1的宽度从32更新为61
我对不同的XQuery进行了研究,以获得有用的结果。我不知道如何隔离我想要的元素,即宽度,然后更新它的值 我使用的是sql Server,可能与
update fixed_width_export_specification_t
set specification_xml.modify
('replace value of (/fixed_width_metadata/
fixed_width_metadata_row
[rowtype = "remit1" and dbname = "remit_column1"]/
width/text())[1]
with 61 ')