gpt4 book ai didi

sql - 如何选择属性名称 (fn :local-name() with xquery

转载 作者:行者123 更新时间:2023-12-03 23:00:52 24 4
gpt4 key购买 nike

此查询 select @x.query('data(realm/roles/role[4]/@*[2])') 针对此 xml(

<realm name="ACP" context="Expresslane">
<roles>
<role name="Administrator" />
<role name="elUser" />
<role name="ElAdministrator" />
<role name="regionalManager" justtest="aaa">
<constraints>
<constraint name="CustomerList" mode="Select">
select * from BaanEl.com010nnn where t$cuno in(select * from baanEl.ftPriceListCustomers(&lt;%=comno%&gt;,&lt;%cpls%&gt;))
</constraint>
</constraints>
</role>
<role name="Rep" />
<role name="DiscountAdministrator" />
<role name="LoginAdmin">
<realm url="http://localhost/PriceWorx_Sandbox/Default.aspx#tabs-2" visible="true" enabled="true" />
</role>
</roles>
<rolegroups>
<rolegroup name="Administrators">
<member name="Administrator" />
<memeber name="elUser" />
<member name="elAdministrator" />
<member name="regionalManagee" />
<member name="Rep" />
<member name="DiscountAdministrator" />
<member name="LoginAdmin" />
</rolegroup>
</rolegroups>
</realm

) returns proper attribute value..

如何获取同一属性的名称(本地名称)?

最佳答案

试试这个:

SELECT  
name = @x.query('local-name((realm/roles/role[4]/@*[2])[1])')
, val = @x.query('data(realm/roles/role[4]/@*[2])')

/* -- OUTPUT
name val
justtest aaa
*/

关于sql - 如何选择属性名称 (fn :local-name() with xquery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5554720/

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