【发布时间】:2021-11-16 16:25:09
【问题描述】:
我正在尝试从我的 SQL 表中的 XML 列中删除特定的“节点”。 下面是 XML 列内容之一的示例。
<GodBrandConfig>
<AppSecret>hello</AppSecret>
<WebClientUrl>url</WebClientUrl>
<AllowableIpAddresses>
<AllowableIpAddress>000.000.000.000</AllowableIpAddress>
<AllowableIpAddress>000.000.000.000</AllowableIpAddress>
<AllowableIpAddress>000.000.000.000</AllowableIpAddress>
<AllowableIpAddress>000.000.000.000</AllowableIpAddress>
<AllowableIpAddress>000.000.000.000</AllowableIpAddress>
<AllowableIpAddress>000.000.000.000</AllowableIpAddress>
<AllowableIpAddress>.*</AllowableIpAddress>
<AllowableIpAddress>000.000.000.000</AllowableIpAddress>
<AllowableIpAddress>000.000.000.000</AllowableIpAddress>
<AllowableIpAddress>000.000.000.000</AllowableIpAddress>
<AllowableIpAddress>000.000.000.000</AllowableIpAddress>
<AllowableIpAddress>178.160.245.88</AllowableIpAddress>
<AllowableIpAddress>000.000.000.000</AllowableIpAddress>
<AllowableIpAddress>000.000.000.000</AllowableIpAddress>
<AllowableIpAddress>000.000.000.000</AllowableIpAddress>
<AllowableIpAddress>000.000.000.000</AllowableIpAddress>
<AllowableIpAddress>000.000.000.000</AllowableIpAddress>
<AllowableIpAddress>000.000.000.000</AllowableIpAddress>
<AllowableIpAddress>000.000.000.000</AllowableIpAddress>
<AllowableIpAddress>178.160.245.88</AllowableIpAddress>
<AllowableIpAddress>000.000.000.000</AllowableIpAddress>
<AllowableIpAddress>000.000.000.000</AllowableIpAddress>
<AllowableIpAddress>000.000.000.000</AllowableIpAddress>
<AllowableIpAddress>000.000.000.000</AllowableIpAddress>
<AllowableIpAddress>000.000.000.000</AllowableIpAddress>
<AllowableIpAddress>000.000.000.000</AllowableIpAddress>
<AllowableIpAddress>000.000.000.000</AllowableIpAddress>
</AllowableIpAddresses>
<GameplaySummaryUrl>about:blank</GameplaySummaryUrl>
</GodBrandConfig>
我正在尝试删除此处的重复记录 - 例如“178.160.245.88”
我一直在尝试“删除”语句的许多变体 - 请我对此提供一些帮助。
set column.modify('delete /GodBrandConfig/AllowableIpAddresses/"178.160.245.88")') where idcolumn= 1125;
【问题讨论】:
-
(1)
000.000.000.000不被认为是重复的吗?它出现了几十次。 (2) 你如何处理像.*这样的值? -
忽略它们——我只是在“屏蔽”这些 IP。我已剥离 XML 以仅包含我要删除的值。
标签: sql-server xml tsql dml