我有一个xml结构如下
<DifficultyRule xmlns="urn:gjensidige:processguide:201201">
<Id>fc39f423-05c0-4de9-ae46-12fe3c0c279b</Id>
<Code>5595e558-7d10-4767-86dc-5d16f24b8151_Code</Code>
<Author />
<Updated>9/5/2012</Updated>
<Sequence>0</Sequence>
<FromControls>
<Control>
<Code>oiuyui</Code>
<Id>70579cbe-c0b5-4b49-a7b8-6201af388f59</Id>
<FilterValues>
<FilterValue xmlns:p5="urn:gjensidige:processguide:201201" p5:Id="b897f3ac-b40f-4b96-b438-eb156a26457e" p5:Code="e" p5:LookupId="3fa26ce7-4031-4e41-92cb-50d8ce56d262" />
</FilterValues>
</Control>
</FromControls>
<DifficultyCode>Red</DifficultyCode>
</DifficultyRule>
我正在尝试删除 xpath 中的 FilterValue 节点
/qn:DifficultyRule/qn:FromControls/qn:Control/qn:FilterValues/qn:FilterValue
基于p5:Id
属性的值,但我对为什么节点没有被删除感到困惑。
下面是我正在使用的脚本:
declare @lookupvalueId varchar(50)
declare @ruleId varchar(50)
set @lookupvalueId = 'b897f3ac-b40f-4b96-b438-eb156a26457e'
set @ruleId = 'fc39f423-05c0-4de9-ae46-12fe3c0c279b'
;WITH XMLNAMESPACES ('urn:gjensidige:processguide:201201' as qn)
update pdr_processdefinitionrule
set PDR_RuleXml.modify('delete (/qn:DifficultyRule/qn:FromControls/qn:Control/qn:FilterValues/qn:FilterValue[@Id=sql:variable("@lookupvalueId")])')
where pdr_guid = @ruleId
我错过了什么?任何指导将不胜感激