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

<tfoot id='yjwbV'></tfoot>

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

        <bdo id='yjwbV'></bdo><ul id='yjwbV'></ul>
      <i id='yjwbV'><tr id='yjwbV'><dt id='yjwbV'><q id='yjwbV'><span id='yjwbV'><b id='yjwbV'><form id='yjwbV'><ins id='yjwbV'></ins><ul id='yjwbV'></ul><sub id='yjwbV'></sub></form><legend id='yjwbV'></legend><bdo id='yjwbV'><pre id='yjwbV'><center id='yjwbV'></center></pre></bdo></b><th id='yjwbV'></th></span></q></dt></tr></i><div class="azbl0fw" id='yjwbV'><tfoot id='yjwbV'></tfoot><dl id='yjwbV'><fieldset id='yjwbV'></fieldset></dl></div>
    1. <legend id='yjwbV'><style id='yjwbV'><dir id='yjwbV'><q id='yjwbV'></q></dir></style></legend>
    2. 刪除 SQL Server 中不同級別的空 XML 標記

      Remove Varying levels of empty XML tags in SQL Server(刪除 SQL Server 中不同級別的空 XML 標記)
      • <small id='8FHbT'></small><noframes id='8FHbT'>

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

            1. <tfoot id='8FHbT'></tfoot>

                <legend id='8FHbT'><style id='8FHbT'><dir id='8FHbT'><q id='8FHbT'></q></dir></style></legend>

              1. 本文介紹了刪除 SQL Server 中不同級別的空 XML 標記的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                限時送ChatGPT賬號..

                我使用 FOR XML EXPLICIT 來聯合將一些 SQL 表信息轉換為 XML 文件.一切正常,但我在結果中有很多不同級別的空標簽.我想刪除所有空標簽,但保留每個組的頂級.這是我的意思的一個例子:

                I am using FOR XML EXPLICIT to union to convert some SQL table info into an XML file. It's all working, but I have loads of empty tags in the results, at all sorts of different levels. I would like to remove all the empty tags, but keep the top level for each group. Here's an example of the sort of thing I mean:

                使用這個無意義的 XML 示例,我可以使用 .modify xquery 刪除底層空節(jié)點:

                Using this example bit of nonsense XML, I can remove the bottom level empty nodes with a .modify xquery:

                DECLARE @XML XML = 
                '<Whatever>
                  <GlassesTypes>
                      <GlassesType />
                  </GlassesTypes>
                  <ExpressionOfJoy>
                      <FellOver>Y</FellOver>
                  </ExpressionOfJoy>
                  <Flights>
                    <Flight>
                      <Bookings>
                        <Booking>
                          <Segments>
                            <Segment />
                          </Segments>
                        </Booking>
                      </Bookings>
                    </Flight>
                  </Flights>
                </Whatever>'
                
                SELECT @XML as Before
                
                SET  @Xml.modify('delete //*[not(node())]');
                
                SELECT @XML AS After
                

                這完全符合我對GlassesTypes"的要求,但Flights"中仍然存在一些級別的空節(jié)點.我可以為每個級別一遍又一遍地重復相同的修改命令,直到只顯示航班",但這樣做會刪除眼鏡類型"空占位符:

                This has done exactly what I want with 'GlassesTypes', but there are still levels of empty nodes in 'Flights'. I could repeat the same modify command over and over for each level to get up to the point where only 'Flights' is displayed, but doing so will delete the 'GlassesTypes' empty placeholder:

                DECLARE @XML XML = 
                '<Whatever>
                  <GlassesTypes>
                      <GlassesType />
                  </GlassesTypes>
                  <ExpressionOfJoy>
                      <FellOver>Y</FellOver>
                  </ExpressionOfJoy>
                  <Flights>
                    <Flight>
                      <Bookings>
                        <Booking>
                          <Segments>
                            <Segment />
                          </Segments>
                        </Booking>
                      </Bookings>
                    </Flight>
                  </Flights>
                </Whatever>'
                
                SELECT @XML as Before
                
                SET  @Xml.modify('delete //*[not(node())]');
                SET  @Xml.modify('delete //*[not(node())]');
                SET  @Xml.modify('delete //*[not(node())]');
                SET  @Xml.modify('delete //*[not(node())]');
                SET  @Xml.modify('delete //*[not(node())]');
                
                SELECT @XML AS After
                

                有什么方法可以刪除所有空節(jié)點,直到倒數第二個空節(jié)點,而不管一個組包含多少層?理想的結果是這樣的:

                Is there any way in which I can delete all empty nodes, until the penultimate empty node, regardless of how many levels a group contains? The ideal result would be this:

                <Whatever>
                  <GlassesTypes />
                  <ExpressionOfJoy>
                      <FellOver>Y</FellOver>
                  </ExpressionOfJoy>
                  <Flights />
                </Whatever>
                

                在這個例子中,只有Whatever"標簽,但在真實數據中,可能有幾個重復的,都包含不同級別的信息,包含在一個根標簽或等效標簽中.

                In this example, there is only 'Whatever' tag, but in the real data, there might be several repeated, all with different levels of information, encompassed by a root tag or equivalent.

                非常感謝任何幫助!

                謝謝,標記

                推薦答案

                您可以將您的空"版本定義為不包含任何后代屬性或文本節(jié)點,而不是不包含任何后代節(jié)點.然后通過僅選擇其子項的后代來保留 的子項:

                You can define your version of "empty" as not containing any descendant attribute or text nodes, instead of as not containing any descendant nodes. Then retain children of <Whatever> by only selecting descendants of its children:

                /Whatever/*//*[empty(.//text() | .//attribute())]
                

                這篇關于刪除 SQL Server 中不同級別的空 XML 標記的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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屋-程序員軟件開發(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()?(為什么會出現“數據類型轉換錯誤?使用 ExecuteNonQuery()?)
                How to show an image from a DataGridView to a PictureBox?(如何將 DataGridView 中的圖像顯示到 PictureBox?)
                <tfoot id='qnvLT'></tfoot>
                  <i id='qnvLT'><tr id='qnvLT'><dt id='qnvLT'><q id='qnvLT'><span id='qnvLT'><b id='qnvLT'><form id='qnvLT'><ins id='qnvLT'></ins><ul id='qnvLT'></ul><sub id='qnvLT'></sub></form><legend id='qnvLT'></legend><bdo id='qnvLT'><pre id='qnvLT'><center id='qnvLT'></center></pre></bdo></b><th id='qnvLT'></th></span></q></dt></tr></i><div class="b5ieakb" id='qnvLT'><tfoot id='qnvLT'></tfoot><dl id='qnvLT'><fieldset id='qnvLT'></fieldset></dl></div>
                • <legend id='qnvLT'><style id='qnvLT'><dir id='qnvLT'><q id='qnvLT'></q></dir></style></legend>
                • <small id='qnvLT'></small><noframes id='qnvLT'>

                        <tbody id='qnvLT'></tbody>

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

                          主站蜘蛛池模板: 精密模具加工制造 - 富东懿 | 北京模型公司-工业模型-地产模型-施工模型-北京渝峰时代沙盘模型制作公司 | 宝鸡市人民医院| 无锡装修装潢公司,口碑好的装饰装修公司-无锡索美装饰设计工程有限公司 | TTCMS自助建站_网站建设_自助建站_免费网站_免费建站_天天向上旗下品牌 | 广州展览设计公司_展台设计搭建_展位设计装修公司-众派展览装饰 广州展览制作工厂—[优简]直营展台制作工厂_展会搭建资质齐全 | 消防设施操作员考试报名时间,报名入口,报考条件 | 阜阳在线-阜阳综合门户| 移动厕所租赁|移动卫生间|上海移动厕所租赁-家瑞租赁 | 圆形振动筛_圆筛_旋振筛_三次元振动筛-河南新乡德诚生产厂家 | 不锈钢列管式冷凝器,换热器厂家-无锡飞尔诺环境工程有限公司 | 代做标书-代写标书-专业标书文件编辑-「深圳卓越创兴公司」 | 硬质合金模具_硬质合金非标定制_硬面加工「生产厂家」-西迪技术股份有限公司 | 筒瓦厂家-仿古瓦-寺庙-古建琉璃瓦-宜兴市古典园林建筑陶瓷厂有限公司 | 成都思迪机电技术研究所-四川成都思迪编码器 | 行业分析:提及郑州火车站附近真有 特殊按摩 ?2025实地踩坑指南 新手如何避坑不踩雷 | 电镀电源整流器_高频电解电源_单脉双脉冲电源 - 东阳市旭东电子科技 | TYPE-C厂家|TYPE-C接口|TYPE-C防水母座|TYPE-C贴片-深圳步步精 | ET3000双钳形接地电阻测试仪_ZSR10A直流_SXJS-IV智能_SX-9000全自动油介质损耗测试仪-上海康登 | 垃圾压缩设备_垃圾处理设备_智能移动式垃圾压缩设备--山东明莱环保设备有限公司 | 消泡剂-水处理消泡剂-涂料消泡剂-切削液消泡剂价格-东莞德丰消泡剂厂家 | STRO|DTRO-STRO反渗透膜(科普)_碟滤| 撕碎机,撕破机,双轴破碎机-大件垃圾破碎机厂家 | 耐酸泵,耐腐蚀真空泵,耐酸真空泵-淄博华舜耐腐蚀真空泵有限公司 精密模具-双色注塑模具加工-深圳铭洋宇通 | 播音主持培训-中影人教育播音主持学苑「官网」-中国艺考界的贵族学校 | 济南轻型钢结构/济南铁艺护栏/济南铁艺大门-济南燕翔铁艺制品有限公司 | 骁龙云呼电销防封号系统-axb电销平台-外呼稳定『免费试用』 | 蒜肠网-动漫,二次元,COSPLAY,漫展以及收藏型模型,手办,玩具的新媒体.(原变形金刚变迷TF圈) | 【中联邦】增稠剂_增稠粉_水性增稠剂_涂料增稠剂_工业增稠剂生产厂家 | 注塑_注塑加工_注塑模具_塑胶模具_注塑加工厂家_深圳环科 | 高清视频编码器,4K音视频编解码器,直播编码器,流媒体服务器,深圳海威视讯技术有限公司 | 三轴曲线机-端子插拔力试验机|华杰仪器 | 精密机械零件加工_CNC加工_精密加工_数控车床加工_精密机械加工_机械零部件加工厂 | 温湿度记录纸_圆盘_横河记录纸|霍尼韦尔记录仪-广州汤米斯机电设备有限公司 | 雷冲击高压发生器-水内冷直流高压发生器-串联谐振分压器-武汉特高压电力科技有限公司 | Safety light curtain|Belt Sway Switches|Pull Rope Switch|ultrasonic flaw detector-Shandong Zhuoxin Machinery Co., Ltd | 共享雨伞_共享童车_共享轮椅_共享陪护床-共享产品的领先者_有伞科技 | 家德利门业,家居安全门,别墅大门 - 安徽家德利门业有限公司 | 宽带办理,电信宽带,移动宽带,联通宽带,电信宽带办理,移动宽带办理,联通宽带办理 | 达利园物流科技集团- | 郑州水质检测中心_井水检测_河南废气检测_河南中环嘉创检测 |