pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

  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="1lhd71d" 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="xzvn1zf" id='Uk7J8'><tfoot id='Uk7J8'></tfoot><dl id='Uk7J8'><fieldset id='Uk7J8'></fieldset></dl></div>

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

                問題描述

                限時送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>
                

                這里我的需要是,我必須查詢具有訪問:允許權(quán)限:刪除值的所有用戶名值.為此,我正在使用以下 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..

                但在這里,我希望結(jié)果只有一個條目 Administrator 而不是 Admin2..因為 Admin2 在兩個不同的 ACEInformation 節(jié)點中同時具有 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..

                在這種情況下,我必須從結(jié)果中排除 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 小提琴演示

                這個會給你想要的結(jié)果.

                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 小提琴演示

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

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

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

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

                相關(guān)文檔推薦

                SQL query to get all products, categories and meta data woocommerce/wordpress(獲取所有產(chǎn)品、類別和元數(shù)據(jù)的 SQL 查詢 woocommerce/wordpress)
                Can I figure out a list of databases and the space used by SQL Server instances without writing SQL queries?(我可以在不編寫 SQL 查詢的情況下找出數(shù)據(jù)庫列表和 SQL Server 實例使用的空間嗎?) - IT屋-程序員軟件開發(fā)
                How to create a login to a SQL Server instance?(如何創(chuàng)建對 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()?(為什么會出現(xiàn)“數(shù)據(jù)類型轉(zhuǎn)換錯誤?使用 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="nf97hfb" 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>
                        • 主站蜘蛛池模板: 标准件-非标紧固件-不锈钢螺栓-非标不锈钢螺丝-非标螺母厂家-三角牙锁紧自攻-南京宝宇标准件有限公司 | 气体检测仪-氢气检测仪-可燃气体传感器-恶臭电子鼻-深国安电子 | 沈阳楼承板_彩钢板_压型钢板厂家-辽宁中盛绿建钢品股份有限公司 轴承振动测量仪电箱-轴承测振动仪器-测试仪厂家-杭州居易电气 | 铝机箱_铝外壳加工_铝外壳厂家_CNC散热器加工-惠州市铂源五金制品有限公司 | 滁州高低温冲击试验箱厂家_安徽高低温试验箱价格|安徽希尔伯特 | ★店家乐|服装销售管理软件|服装店收银系统|内衣店鞋店进销存软件|连锁店管理软件|收银软件手机版|会员管理系统-手机版,云版,App | 玉米深加工机械,玉米加工设备,玉米加工机械等玉米深加工设备制造商-河南成立粮油机械有限公司 | 361°官方网站 | 热处理温控箱,热处理控制箱厂家-吴江市兴达电热设备厂 | 媒介云-全网整合营销_成都新闻媒体发稿_软文发布平台 | 招商帮-一站式网络营销服务|互联网整合营销|网络推广代运营|信息流推广|招商帮企业招商好帮手|搜索营销推广|短视视频营销推广 | 武汉森源蓝天环境科技工程有限公司-为环境污染治理提供协同解决方案 | 网站优化公司_北京网站优化_抖音短视频代运营_抖音关键词seo优化排名-通则达网络 | 五轴加工中心_数控加工中心_铝型材加工中心-罗威斯 | 纸布|钩编布|钩针布|纸草布-莱州佳源工艺纸布厂 | 防潮防水通风密闭门源头实力厂家 - 北京酷思帝克门窗 | 【德信自动化】点胶机_全自动点胶机_自动点胶机厂家_塑料热压机_自动螺丝机-深圳市德信自动化设备有限公司 | 电磁流量计厂家_涡街流量计厂家_热式气体流量计-青天伟业仪器仪表有限公司 | 上海冠顶工业设备有限公司-隧道炉,烘箱,UV固化机,涂装设备,高温炉,工业机器人生产厂家 | EDLC超级法拉电容器_LIC锂离子超级电容_超级电容模组_软包单体电容电池_轴向薄膜电力电容器_深圳佳名兴电容有限公司_JMX专注中高端品牌电容生产厂家 | 手术室净化厂家_成都实验室装修公司_无尘车间施工单位_洁净室工程建设团队-四川华锐16年行业经验 | BESWICK球阀,BESWICK接头,BURKERT膜片阀,美国SEL继电器-东莞市广联自动化科技有限公司 | RS系列电阻器,RK_RJ启动调整电阻器,RQ_RZ电阻器-上海永上电器有限公司 | 渣土车电机,太阳能跟踪器电机,蜗轮蜗杆减速电机厂家-淄博传强电机 | 超声波成孔成槽质量检测仪-压浆机-桥梁预应力智能张拉设备-上海硕冠检测设备有限公司 | 飞利浦LED体育场灯具-吸顶式油站灯-飞利浦LED罩棚灯-佛山嘉耀照明有限公司 | 企典软件一站式企业管理平台,可私有、本地化部署!在线CRM客户关系管理系统|移动办公OA管理系统|HR人事管理系统|人力 | 博莱特空压机|博莱特-阿特拉斯独资空压机品牌核心代理商 | 在线钠离子分析仪-硅酸根离子浓度测定仪-油液水分测定仪价格-北京时代新维测控设备有限公司 | 百度关键词优化_网站优化_SEO价格 - 云无限好排名 | 杰福伦_磁致伸缩位移传感器_线性位移传感器-意大利GEFRAN杰福伦-河南赉威液压科技有限公司 | 会议会展活动拍摄_年会庆典演出跟拍_摄影摄像直播-艾木传媒 | lcd条形屏-液晶长条屏-户外广告屏-条形智能显示屏-深圳市条形智能电子有限公司 | 流量检测仪-气密性检测装置-密封性试验仪-东莞市奥图自动化科技有限公司 | 泉州陶瓷pc砖_园林景观砖厂家_石英砖地铺石价格 _福建暴风石英砖 | 钢格板|镀锌钢格板|热镀锌钢格板|格栅板|钢格板|钢格栅板|热浸锌钢格板|平台钢格板|镀锌钢格栅板|热镀锌钢格栅板|平台钢格栅板|不锈钢钢格栅板 - 专业钢格板厂家 | 洛阳装修公司-洛阳整装一站式品牌-福尚云宅装饰 | 纯化水设备-纯水设备-超纯水设备-[大鹏水处理]纯水设备一站式服务商-东莞市大鹏水处理科技有限公司 | 云南成人高考网| 超声波反应釜【百科】-以马内利仪器| 广州办公室设计,办公室装修,写字楼设计,办公室装修公司_德科 |