1
我有一個XML結構如下刪除XML節點2008表列基於元素值
<ControlVisibilityRule xmlns="urn:gjensidige:processguide:201201">
<Id>e68c53a3-79ba-41e4-81cb-341050016783</Id>
<Code>b53b687c-2617-4d02-8aa0-4d0d0898bd15_Code</Code>
<Author />
<Updated>9/5/2012</Updated>
<Sequence>0</Sequence>
<FromControls>
<Control>
<Code>ada</Code>
<Id>ba2abc55-3b25-4280-8bd0-a1d23a4575d0</Id>
<FilterValues>
<FilterValue xmlns:p5="urn:gjensidige:processguide:201201" p5:Id="e2b830f8-9a58-4edf-b56c-4c5a9580f362" p5:Code="1" p5:LookupId="ebb6066f-a976-4dcb-aabe-07c4f7d2686b" />
<FilterValue xmlns:p5="urn:gjensidige:processguide:201201" p5:Id="44e268ef-2869-4df1-b61e-c59c2d3f1a5a" p5:Code="56" p5:LookupId="ebb6066f-a976-4dcb-aabe-07c4f7d2686b" />
</FilterValues>
</Control>
</FromControls>
<ToControls>
<Control>
<Code>adeUnittest01</Code>
<Id>0a1cd240-20ee-4405-9613-d3006693c390</Id>
</Control>
</ToControls>
<IsVisible>True</IsVisible>
</ControlVisibilityRule>
我想刪除元素ID中的XPath
/qn:ControlVisibilityRule/qn:ToControls/qn:Control/qn:Id
,其值是0a1cd240-20ee-4405-9613-d3006693c390
。我已經做了,直到下面,但我敢肯定,我的思念與可變元素值的比較。
declare @Id nvarchar(50)
declare @ruleId nvarchar(50)
;WITH XMLNAMESPACES ('urn:gjensidige:processguide:201201' as qn)
update
pdr_processdefinitionrule
set
PDR_RuleXml.modify('delete (/qn:ControlVisibilityRule/qn:ToControls/qn:Control/qn:Id=sql:variable("@Id"))')
where pdr_guid = @ruleId
任何指導,可以理解
非常感謝你@marc_s能否請你看看我的其他問題上的計算器就刪除XML節點根據張貼在這裏的屬性值[鏈接](http://stackoverflow.com/questions/12296091/delete-xml-node - 從-SQL服務器2008 R2的表列的基礎上,屬性值) –
@HamzaAhmedZia:回答您的其他問題,以及。 –