久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

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

        <bdo id='nUqZW'></bdo><ul id='nUqZW'></ul>
    1. <small id='nUqZW'></small><noframes id='nUqZW'>

      XQuery 存在檢查選擇 sql 查詢

      XQuery exists check in select sql query(XQuery 存在檢查選擇 sql 查詢)
      <tfoot id='Uk7J8'></tfoot>
      • <bdo id='Uk7J8'></bdo><ul id='Uk7J8'></ul>

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

      • <legend id='Uk7J8'><style id='Uk7J8'><dir id='Uk7J8'><q id='Uk7J8'></q></dir></style></legend>

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

                本文介紹了XQuery 存在檢查選擇 sql 查詢的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                限時送ChatGPT賬號..

                我有一個帶有 xml 列的 sql 表,其中包含如下 xml 的值

                I have one sql table with xml column which holds the value like below xml

                <Security xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                  <Dacl>
                    <ACEInformation>
                      <UserName>Authenticated Users</UserName>
                      <Access>Allow</Access>
                      <IsInherited>false</IsInherited>
                      <ApplyTo>This object only</ApplyTo>
                      <Permission>List Contents</Permission>
                      <Permission>Read All Properties</Permission>
                      <Permission>Read Permissions</Permission>
                    </ACEInformation>
                    <ACEInformation>
                      <UserName>Administrator</UserName>
                      <Access>Allow</Access>
                      <IsInherited>false</IsInherited>
                      <ApplyTo>This object only</ApplyTo>
                      <Permission>Read All Properties</Permission>
                      <Permission>Delete</Permission>
                    </ACEInformation>
                    <ACEInformation>
                      <UserName>Admin2</UserName>
                      <Access>Allow</Access>
                      <IsInherited>false</IsInherited>
                      <ApplyTo>This object only</ApplyTo>
                      <Permission>Read All Properties</Permission>
                      <Permission>Delete</Permission>
                    </ACEInformation>
                    <ACEInformation>
                      <UserName>Admin2</UserName>
                      <Access>Deny</Access>
                      <IsInherited>false</IsInherited>
                      <ApplyTo>This object only</ApplyTo>
                      <Permission>Read All Properties</Permission>
                      <Permission>Delete</Permission>
                    </ACEInformation>
                  </Dacl>
                </Security>
                

                這里我的需要是,我必須查詢具有訪問:允許權限:刪除值的所有用戶名值.為此,我正在使用以下 XQuery.

                Here my need is, I have to query all UserName values who are having values Access: Allow and Permission: Delete. For that, I am using following XQuery.

                select (
                       select A.X.value('(UserName/text())[1]', 'nvarchar(max)')+';'
                       from T.xmlColumn.nodes('/Security/Dacl/ACEInformation[Access = "Allow" and Permission = "Delete"]') as A(X)
                       for xml path(''), type
                       ).value('text()[1]', 'nvarchar(max)')
                from myTable as T
                

                它返回值:Administrator;Admin2 用于上述 xml.查詢工作正常..

                It returns the value : Administrator;Admin2 for above xml. the query is working fine..

                但在這里,我希望結果只有一個條目 Administrator 而不是 Admin2..因為 Admin2 在兩個不同的 ACEInformation 節點中同時具有 Access:AllowAccess: Deny 值..

                But here, I expect the result only one entry Administrator not Admin2.. because Admin2 has both Access:Allow and Access: Deny values in two different ACEInformation node..

                在這種情況下,我必須從結果中排除 Admin2,即使它具有 Access:Allow.

                In that case, I have to exclude Admin2 from result, even though it has the Access:Allow.

                誰能給我這個案例的xquery?

                Can you any one give me the xquery for this case?

                推薦答案

                with cte as (
                    select
                        A.X.value('(UserName/text())[1]', 'nvarchar(max)') as UserName,
                        A.X.value('(Access/text())[1]', 'nvarchar(max)') as Access
                    from myTable as T
                        outer apply T.xmlColumn.nodes('/Security/Dacl/ACEInformation[Permission = "Delete"]') as A(X)
                )
                select *
                from cte as c1
                where
                    c1.Access = 'Allow' and
                    not exists (select * from cte as c2 where c2.UserName = c1.UserName and c2.Access = 'Deny')
                

                sql 小提琴演示

                這個會給你想要的結果.

                This one will give you desired result.

                with cte as (
                    select
                        T.ID,
                        A.X.value('(UserName/text())[1]', 'nvarchar(max)') as UserName,
                        A.X.value('(Access/text())[1]', 'nvarchar(max)') as Access
                    from myTable as T
                        outer apply T.xmlColumn.nodes('/Security/Dacl/ACEInformation[Permission = "Delete"]') as A(X)
                )
                select
                    T.ID,
                    stuff(
                        (
                            select ',' + c1.UserName
                            from cte as c1
                            where
                              c1.ID = T.ID and c1.Access = 'Allow' and
                              not exists (select * from cte as c2 where c2.ID = T.ID and c2.UserName = c1.UserName and c2.Access = 'Deny')
                            for xml path(''), type
                        ).value('.', 'nvarchar(max)')
                    ,1,1,'')
                from myTable as T
                

                sql 小提琴演示

                我認為使用純 XQuery 可以做到這一點,稍后嘗試添加.

                I think it's possible to do this with pure XQuery, try to add this later.

                這篇關于XQuery 存在檢查選擇 sql 查詢的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                SQL query to get all products, categories and meta data woocommerce/wordpress(獲取所有產品、類別和元數據的 SQL 查詢 woocommerce/wordpress)
                Can I figure out a list of databases and the space used by SQL Server instances without writing SQL queries?(我可以在不編寫 SQL 查詢的情況下找出數據庫列表和 SQL Server 實例使用的空間嗎?) - IT屋-程序員軟件開發
                How to create a login to a SQL Server instance?(如何創建對 SQL Server 實例的登錄?)
                How to know the version and edition of SQL Server through registry search(如何通過注冊表搜索知道SQL Server的版本和版本)
                Why do I get a quot;data type conversion errorquot; with ExecuteNonQuery()?(為什么會出現“數據類型轉換錯誤?使用 ExecuteNonQuery()?)
                How to show an image from a DataGridView to a PictureBox?(如何將 DataGridView 中的圖像顯示到 PictureBox?)

                      <tbody id='6jwAE'></tbody>

                        • <bdo id='6jwAE'></bdo><ul id='6jwAE'></ul>
                          <i id='6jwAE'><tr id='6jwAE'><dt id='6jwAE'><q id='6jwAE'><span id='6jwAE'><b id='6jwAE'><form id='6jwAE'><ins id='6jwAE'></ins><ul id='6jwAE'></ul><sub id='6jwAE'></sub></form><legend id='6jwAE'></legend><bdo id='6jwAE'><pre id='6jwAE'><center id='6jwAE'></center></pre></bdo></b><th id='6jwAE'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='6jwAE'><tfoot id='6jwAE'></tfoot><dl id='6jwAE'><fieldset id='6jwAE'></fieldset></dl></div>

                          <small id='6jwAE'></small><noframes id='6jwAE'>

                          <tfoot id='6jwAE'></tfoot>

                          <legend id='6jwAE'><style id='6jwAE'><dir id='6jwAE'><q id='6jwAE'></q></dir></style></legend>
                        • 主站蜘蛛池模板: 日韩av大片免费看 | 亚洲综合第一页 | 在线视频91| 在线观看日韩av | 精品国产色 | 久久精品久久久久久 | 不卡视频在线 | 久久久久91 | 九九热精品视频 | 久久机热 | 欧美色影院| 国产三级日本三级 | 国产高清亚洲 | 91免费看片 | 亚洲精品一区二区在线观看 | 中文字幕一区二区三区不卡 | 亚洲国产精品久久久久婷婷老年 | 亚洲日韩中文字幕一区 | 欧美日韩综合 | 在线欧美小视频 | 搞黄网站在线观看 | 亚洲精品国产综合区久久久久久久 | 成人精品国产免费网站 | 日日操夜夜干 | 久久99精品久久久久蜜桃tv | 亚洲欧美一区二区三区国产精品 | 久久久久一区二区三区 | 一级黄色毛片免费 | 亚洲淫视频 | 91视频大全 | 成人在线免费观看视频 | 日本一本在线 | 色啪网| 亚洲精品免费在线观看 | 色综合久久久 | 精区3d动漫一品二品精区 | 黄色成人在线 | 欧美日韩中文字幕 | 成人1区| 久久99这里只有精品 | 国产不卡在线观看 |