我有一个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>
我试图删除FilterValue节点中的XPath
/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
我在想什么? 任何指导,可以理解