• <bdo id='Xli3K'></bdo><ul id='Xli3K'></ul>

      <tfoot id='Xli3K'></tfoot>
      1. <i id='Xli3K'><tr id='Xli3K'><dt id='Xli3K'><q id='Xli3K'><span id='Xli3K'><b id='Xli3K'><form id='Xli3K'><ins id='Xli3K'></ins><ul id='Xli3K'></ul><sub id='Xli3K'></sub></form><legend id='Xli3K'></legend><bdo id='Xli3K'><pre id='Xli3K'><center id='Xli3K'></center></pre></bdo></b><th id='Xli3K'></th></span></q></dt></tr></i><div id='Xli3K'><tfoot id='Xli3K'></tfoot><dl id='Xli3K'><fieldset id='Xli3K'></fieldset></dl></div>
      2. <legend id='Xli3K'><style id='Xli3K'><dir id='Xli3K'><q id='Xli3K'></q></dir></style></legend>

        <small id='Xli3K'></small><noframes id='Xli3K'>

        XQuery 检索值

        时间:2023-06-06
            <tbody id='PnWyo'></tbody>

                <tfoot id='PnWyo'></tfoot>

                <small id='PnWyo'></small><noframes id='PnWyo'>

                  <bdo id='PnWyo'></bdo><ul id='PnWyo'></ul>

                  <i id='PnWyo'><tr id='PnWyo'><dt id='PnWyo'><q id='PnWyo'><span id='PnWyo'><b id='PnWyo'><form id='PnWyo'><ins id='PnWyo'></ins><ul id='PnWyo'></ul><sub id='PnWyo'></sub></form><legend id='PnWyo'></legend><bdo id='PnWyo'><pre id='PnWyo'><center id='PnWyo'></center></pre></bdo></b><th id='PnWyo'></th></span></q></dt></tr></i><div id='PnWyo'><tfoot id='PnWyo'></tfoot><dl id='PnWyo'><fieldset id='PnWyo'></fieldset></dl></div>

                • <legend id='PnWyo'><style id='PnWyo'><dir id='PnWyo'><q id='PnWyo'></q></dir></style></legend>
                • 本文介绍了XQuery 检索值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我有以下 T-SQL 使用两个条件确定行是否存在:

                  I have the following T-SQL that determines if a row exists using two criteria:

                  Declare @x xml = '
                      <row ParentID="45" ObjectID="0" Node="root.local.navigation[7]" itemKey="page" itemValue="Confirmation" itemType="string" />
                      <row ParentID="45" ObjectID="0" Node="root.local.navigation[7]" itemKey="visited" itemValue="false" itemType="bool" />'
                  
                  SELECT @x.exist('/row[@Node eq "root.local.navigation[7]"] and /row[@itemValue eq "Confirmation"]')
                  

                  问题:鉴于上面的 SELECT,我如何选择第二行的 itemValue?即,由于有一行 Node="root.local.navigation[7]" 和 itemValue="Confirmation",在 node 相同且 itemKey="visited" 的行中返回 itemType 值?

                  Question: Given the above SELECT, how can I SELECT the second row's itemValue? i.e. Since there's a row with Node="root.local.navigation[7]" and itemValue="Confirmation", return the itemType value in the row where node is the same and itemKey="visited"?

                  推荐答案

                  这个怎么样:

                  declare @x xml = '
                  <row ParentID="45" ObjectID="0" Node="root.local.navigation[7]" itemKey="page" itemValue="Confirmation" itemType="string" />
                  <row ParentID="45" ObjectID="0" Node="root.local.navigation[7]" itemKey="visited" itemValue="false" itemType="bool" />'
                  
                  select case when @x.exist('/row[@Node eq "root.local.navigation[7]"] and /row[@itemValue eq "Confirmation"]') = 1 
                      then @x.value('/row[@Node eq "root.local.navigation[7]" and @itemKey eq "visited"][1]/@itemType', 'varchar(50)') 
                  end as item_type
                  

                  这篇关于XQuery 检索值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在 SQL 中对 XML 属性进行排序 下一篇:带有 SQL 的 XML 节点

                  相关文章

                  最新文章

                  1. <small id='liFjj'></small><noframes id='liFjj'>

                    <tfoot id='liFjj'></tfoot>
                    1. <i id='liFjj'><tr id='liFjj'><dt id='liFjj'><q id='liFjj'><span id='liFjj'><b id='liFjj'><form id='liFjj'><ins id='liFjj'></ins><ul id='liFjj'></ul><sub id='liFjj'></sub></form><legend id='liFjj'></legend><bdo id='liFjj'><pre id='liFjj'><center id='liFjj'></center></pre></bdo></b><th id='liFjj'></th></span></q></dt></tr></i><div id='liFjj'><tfoot id='liFjj'></tfoot><dl id='liFjj'><fieldset id='liFjj'></fieldset></dl></div>
                    2. <legend id='liFjj'><style id='liFjj'><dir id='liFjj'><q id='liFjj'></q></dir></style></legend>

                        <bdo id='liFjj'></bdo><ul id='liFjj'></ul>