gpt4 book ai didi

xml - SQL 2008 从 XML 列中检索属性值

转载 作者:数据小太阳 更新时间:2023-10-29 02:05:39 25 4
gpt4 key购买 nike

具体来说,给定元数据列中的以下 XML 内容,我如何检索具有特定名称属性的节点的值?

在这种情况下,我在与 int16_t 标签关联的值和名称“filterIndex”之后

<root version="1">
<class derived_type="FilterInfo" name="FilterInfo">
<string name="filterName" length="3" value="mt8" />
<string name="filterText" length="3" value="SVR" />
<string name="filterTable" length="11" value="CML_5_1_mt8" />
<bool name="userDefined" value="true" />
<bool name="multiResp" value="false" />
<enumeration name="filterType" value="1" />
<enumeration name="filterCategory" value="1" />
<vector name="options" count="1">
<class derived_type="OptionInfo" name="V0">
<int16_t name="optionIndex" value="1" />
<string name="optionName" length="3" value="mt8" />
<string name="optionText" length="3" value="SVR" />
<string name="optionTable" length="11" value="CML_5_1_mt8" />
</class>
</vector>
<GUID name="primaryKey" value="fe66b60f-468a-4f0e-be80-0055e20baa35" />
<int16_t name="filterIndex" value="1080" />
</class>
</root>

感谢++

杰瑞。

最佳答案

像这样的东西??

SELECT
metadata.value('(/root/class/int16_t/@value)[1]', 'int') AS 'int16_value'
FROM
dbo.YourTable

关于xml - SQL 2008 从 XML 列中检索属性值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5221553/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com