问题描述
我在 SQL 存储过程中有一个 XML 参数 @Xml,如下所示:
I have an XML parameter @Xml in SQL Stored procedure like below:
现在,我想删除这个xml中的几个节点,过滤器是这样的(Id = 2 AND Name = 'Alex') OR (Id = 3 AND Name = 'Amy'),我不想使用 Cursor 或类似的东西,只需使用一个脚本来完成它,我正在尽我所能,但我无法得到答案,有人可以帮助我吗?提前致谢!!!
now, I want to delete several nodes in this xml, the filter is like this (Id = 2 AND Name = 'Alex') OR (Id = 3 AND Name = 'Amy'), I don't want to use Cursor or something like this, just using one single script to do it, I am try to my best for this, but I can't get the answer, anybody can help me ? Thanks in advance!!!
输出应该是:
PS:过滤器是一个#table,那么,实际的问题是,如何删除包含在#table中的XML中的特定记录?
PS: the filter is a #table, so, the actually question is , how to remove the specific records in XML which contains in #table?
<小时>
我得到了这样的结果1凯文
I got results like this 1 Kevin
但我需要整个xml包含根节点:
But I need the the whole xml contains Root node:
我怎样才能达到这个目标?有什么帮助吗?我是 SQL 到 XML 的新手,请帮助我!!!
How can I reach this? Any help? I am an new leaner for SQL to XML, please help me !!!
推荐答案
我得到了答案,谢谢大家
I got the answer, thanks all you guys
这篇关于如何使用 for 循环使用 XQuery 删除 xml 节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!