--修改FunctionNo节点值,@OperateFunctionNo为参数
set @DataXml.modify('replace value of (/CrudData/FunctionNo/text())[1] with sql:variable("@OperateFunctionNo")')
--删除节点
SET @DataXml.modify('delete (/CrudData/DataKey)[1]')
--插入节点
SET @DataXml.modify('insert <DataKey></DataKey> as first into (/CrudData)[1]')
--插入文本
SET @DataXml.modify('insert text{sql:variable("@DataKey")} as first into (/CrudData/DataKey)[1]')
--DataKeyList值获取
SET @DataKeyList = @DataXml.value('(/CrudData/DataKeyList)[1]', 'nvarchar(max)')
XML文本为
<CrudData>
<ConnKey>SupplierData</ConnKey>
<AppNo>20</AppNo>
<FunctionNo>200000</FunctionNo>
<Command>DoApproveSubjectList</Command>
<DataKeyList>3210002010402020170508000004,3210002010402020170228000002</DataKeyList>
<ApprovalResult>2</ApprovalResult>
<OperateFunctionNo>204020</OperateFunctionNo>
</CrudData>