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

  • <legend id='9uVWh'><style id='9uVWh'><dir id='9uVWh'><q id='9uVWh'></q></dir></style></legend>

    <small id='9uVWh'></small><noframes id='9uVWh'>

    1. <tfoot id='9uVWh'></tfoot>

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

        使用 Xquery 透視復雜的 XML

        Pivot complex XML using Xquery(使用 Xquery 透視復雜的 XML)
        <legend id='RbrVf'><style id='RbrVf'><dir id='RbrVf'><q id='RbrVf'></q></dir></style></legend>

            • <tfoot id='RbrVf'></tfoot>

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

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

                  本文介紹了使用 Xquery 透視復雜的 XML的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  是否可以將以下 xml 轉換為以下結果集,或讓結構盡可能接近它?它顯然可以有超過 1 個具有相似數據的項目,我剛剛對其進行了修剪,因此文件中只有項目 sku 987654.

                  Is it possible to pivot the following xml into the following result set, or get the structure as close to it as possible? It can obviously have more than 1 item with similar data, I have just trimmed it down so only item sku 987654 is in the file.

                  DECLARE @XML AS XML = '<data xsi:schemaLocation="http://www.intershop.com/xml/ns/enfinity/7.0/xcs/impex catalog.xsd http://www.intershop.com/xml/ns/enfinity/6.5/core/impex-dt dt.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.intershop.com/xml/ns/enfinity/7.0/xcs/impex" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:dt="http://www.intershop.com/xml/ns/enfinity/6.5/core/impex-dt" major="6" minor="1" family="enfinity" branch="enterprise" build="2.6.6-R-1.1.59.2-20210714.2">
                  <item sku="987654">
                  <sku>987654</sku>
                  <category-links>
                  <category-link name="abc" domain="WhiteStuff-DE-WebCategories" default = "0" hotdeal = "0"/>
                  <category-link name="def" domain="WhiteStuff-DE-WebCategories" default = "1" hotdeal = "0"/>
                  <category-link name="ghi" domain="WhiteStuff-DE-WebCategories" default = "0" hotdeal = "0"/>
                  </category-links>
                  <images>
                  <primary-view image-view="FF" />
                  <image-ref image-view="FD" image-type="w150" image-base-name="FD.jpg" domain="WhiteStuff" />
                  <image-ref image-view="FF" image-type="ORI" image-base-name="FF.jpg" domain="WhiteStuff" />
                  </images>
                  <variations>
                  <variation-attributes>
                  <variation-attribute name = "size">
                  <presentation-option>default</presentation-option>
                  <custom-attributes>
                  <custom-attribute name="displayName" dt:dt="string" xml:lang="en-US">Size</custom-attribute>
                  <custom-attribute name="productDetailUrl" xml:lang="de-DE" dt:dt="string">123.co.uk</custom-attribute>
                  </custom-attributes>
                  </variation-attribute>
                  <variation-attribute name = "colour">
                  <presentation-option>colorCode</presentation-option>
                  <presentation-product-attribute-name>rgbColour</presentation-product-attribute-name>
                  <custom-attributes>
                  <custom-attribute name="displayName" dt:dt="string" xml:lang="en-US">Colour</custom-attribute>
                  <custom-attribute name="productDetailUrl" xml:lang="de-DE" dt:dt="string">456.co.uk</custom-attribute>
                  </custom-attributes>
                  </variation-attribute>
                  </variation-attributes>
                  </variations>
                  </item>
                  </data>
                  '
                  

                  這是我的起點:

                  ;WITH XMLNAMESPACES 
                  (
                      DEFAULT 'http://www.intershop.com/xml/ns/enfinity/7.0/xcs/impex',
                      'http://www.intershop.com/xml/ns/enfinity/6.5/core/impex-dt' as dt
                  )
                  
                  SELECT n.value('@sku', 'nvarchar(max)') as [sku]
                  
                      --[category-link],
                      --[FD image],
                      --[FF image],
                      --[productDetailUrl DE],
                      --[productDetailUrl EN]
                  
                  FROM @XML.nodes('/data/item') as x(n);
                  

                  推薦答案

                  不太清楚如何區分語言:

                  It is not so clear how to distinguish between languages:

                  • [productDetailUrl DE]
                  • [productDetailUrl EN]

                  除此之外,請嘗試以下解決方案.它會讓你開始.

                  Other than that, please try the following solution. It will get you started.

                  SQL

                  DECLARE @XML AS XML = 
                  N'<?xml version="1.0"?>
                  <data xsi:schemaLocation="http://www.intershop.com/xml/ns/enfinity/7.0/xcs/impex catalog.xsd http://www.intershop.com/xml/ns/enfinity/6.5/core/impex-dt dt.xsd"
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                        xmlns="http://www.intershop.com/xml/ns/enfinity/7.0/xcs/impex"
                        xmlns:xml="http://www.w3.org/XML/1998/namespace"
                        xmlns:dt="http://www.intershop.com/xml/ns/enfinity/6.5/core/impex-dt"
                        major="6" minor="1" family="enfinity" branch="enterprise"
                        build="2.6.6-R-1.1.59.2-20210714.2">
                      <item sku="987654">
                          <sku>987654</sku>
                          <category-links>
                              <category-link name="abc" domain="WhiteStuff-DE-WebCategories"
                                             default="0" hotdeal="0"/>
                              <category-link name="def" domain="WhiteStuff-DE-WebCategories"
                                             default="1" hotdeal="0"/>
                              <category-link name="ghi" domain="WhiteStuff-DE-WebCategories"
                                             default="0" hotdeal="0"/>
                          </category-links>
                          <images>
                              <primary-view image-view="FF"/>
                              <image-ref image-view="FD" image-type="w150"
                                         image-base-name="FD.jpg" domain="WhiteStuff"/>
                              <image-ref image-view="FF" image-type="ORI" image-base-name="FF.jpg"
                                         domain="WhiteStuff"/>
                          </images>
                          <variations>
                              <variation-attributes>
                                  <variation-attribute name="size">
                                      <presentation-option>default</presentation-option>
                                      <custom-attributes>
                                          <custom-attribute name="displayName" dt:dt="string"
                                                            xml:lang="en-US">Size</custom-attribute>
                                          <custom-attribute name="productDetailUrl"
                                                            xml:lang="de-DE" dt:dt="string">123.co.uk</custom-attribute>
                                      </custom-attributes>
                                  </variation-attribute>
                                  <variation-attribute name="colour">
                                      <presentation-option>colorCode</presentation-option>
                                      <presentation-product-attribute-name>rgbColour</presentation-product-attribute-name>
                                      <custom-attributes>
                                          <custom-attribute name="displayName" dt:dt="string"
                                                            xml:lang="en-US">Colour</custom-attribute>
                                          <custom-attribute name="productDetailUrl"
                                                            xml:lang="de-DE" dt:dt="string">456.co.uk</custom-attribute>
                                      </custom-attributes>
                                  </variation-attribute>
                              </variation-attributes>
                          </variations>
                      </item>
                  </data>';
                  
                  ;WITH XMLNAMESPACES 
                  (
                      DEFAULT 'http://www.intershop.com/xml/ns/enfinity/7.0/xcs/impex',
                      'http://www.intershop.com/xml/ns/enfinity/6.5/core/impex-dt' as dt
                  )
                  
                  SELECT c.value('@sku', 'nvarchar(max)') as [sku]
                      , n.value('@name','VARCHAR(20)') AS [category-link]
                      , c.value('(images/image-ref[@image-view="FD"]/@image-base-name)[1]','VARCHAR(20)') AS [FD image]
                      , c.value('(images/image-ref[@image-view="FF"]/@image-base-name)[1]','VARCHAR(20)') AS [FF image]
                      , c.value('(variations/variation-attributes/variation-attribute/custom-attributes/custom-attribute[@xml:lang="de-DE"]/text())[1]','VARCHAR(20)') AS [productDetailUrl DE]
                      , c.value('(variations/variation-attributes/variation-attribute[@name="colour"]/custom-attributes/custom-attribute[@xml:lang="de-DE"]/text())[1]','VARCHAR(20)') AS [productDetailUrl EN]
                  FROM @XML.nodes('/data/item') as t(c)
                      CROSS APPLY t.c.nodes('category-links/category-link') AS t2(n);
                  

                  輸出

                  +--------+---------------+----------+----------+---------------------+---------------------+
                  |  sku   | category-link | FD image | FF image | productDetailUrl DE | productDetailUrl EN |
                  +--------+---------------+----------+----------+---------------------+---------------------+
                  | 987654 | abc           | FD.jpg   | FF.jpg   | 123.co.uk           | 456.co.uk           |
                  | 987654 | def           | FD.jpg   | FF.jpg   | 123.co.uk           | 456.co.uk           |
                  | 987654 | ghi           | FD.jpg   | FF.jpg   | 123.co.uk           | 456.co.uk           |
                  +--------+---------------+----------+----------+---------------------+---------------------+
                  

                  這篇關于使用 Xquery 透視復雜的 XML的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  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?)
                  WinForms application design - moving documents from SQL Server to file storage(WinForms 應用程序設計——將文檔從 SQL Server 移動到文件存儲)

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

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

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

                              <tbody id='UR5HN'></tbody>
                          1. 主站蜘蛛池模板: 浙江红酒库-冰雕库-气调库-茶叶库安装-医药疫苗冷库-食品物流恒温恒湿车间-杭州领顺实业有限公司 | 包装设计公司,产品包装设计|包装制作,包装盒定制厂家-汇包装【官方网站】 | 播音主持培训-中影人教育播音主持学苑「官网」-中国艺考界的贵族学校 | 泰安办公家具-泰安派格办公用品有限公司 | CXB船用变压器-JCZ系列制动器-HH101船用铜质开关-上海永上船舶电器厂 | Maneurop/美优乐压缩机,活塞压缩机,型号规格,技术参数,尺寸图片,价格经销商 | 杭州双螺杆挤出机-百科 | 无菌实验室规划装修设计-一体化实验室承包-北京洁净净化工程建设施工-北京航天科恩实验室装备工程技术有限公司 | 骨密度仪-骨密度测定仪-超声骨密度仪-骨龄测定仪-天津开发区圣鸿医疗器械有限公司 | 天津次氯酸钠酸钙溶液-天津氢氧化钠厂家-天津市辅仁化工有限公司 | 博博会2021_中国博物馆及相关产品与技术博览会【博博会】 | 石家庄救护车出租_重症转院_跨省跨境医疗转送_活动赛事医疗保障_康复出院_放弃治疗_腾康26年医疗护送转诊团队 | 企业微信营销_企业微信服务商_私域流量运营_艾客SCRM官网 | 【甲方装饰】合肥工装公司-合肥装修设计公司,专业从事安徽办公室、店面、售楼部、餐饮店、厂房装修设计服务 | 新能源汽车教学设备厂家报价[汽车教学设备运营18年]-恒信教具 | 济南冷库安装-山东冷库设计|建造|冷库维修-山东齐雪制冷设备有限公司 | 药品仓库用除湿机-变电站用防爆空调-油漆房用防爆空调-杭州特奥环保科技有限公司 | 隔离变压器-伺服变压器--输入输出电抗器-深圳市德而沃电气有限公司 | 道康宁消泡剂-瓦克-大川进口消泡剂供应商| 凝胶成像系统(wb成像系统)百科-上海嘉鹏 | 热镀锌槽钢|角钢|工字钢|圆钢|H型钢|扁钢|花纹板-天津千百顺钢铁贸易有限公司 | 西门子伺服控制器维修-伺服驱动放大器-828D数控机床维修-上海涌迪 | 心肺复苏模拟人|医学模型|急救护理模型|医学教学模型上海康人医学仪器设备有限公司 | 沈阳建筑设计公司_加固改造设计_厂房设计_设计资质加盟【金辉设计】 | UV固化机_UVLED光固化机_UV干燥机生产厂家-上海冠顶公司专业生产UV固化机设备 | 微型气泵-真空-蠕动-水泵-厂家-深圳市品亚科技有限公司 | 上海三信|ph计|酸度计|电导率仪-艾科仪器 | 宜兴紫砂壶知识分享 - 宜兴壶人 医用空气消毒机-医用管路消毒机-工作服消毒柜-成都三康王 | 亮化工程,亮化设计,城市亮化工程,亮化资质合作,长沙亮化照明,杰奥思【官网】 | 航空铝型材,7系铝型材挤压,硬质阳*氧化-余润铝制品 | 工业冷却塔维修厂家_方形不锈钢工业凉水塔维修改造方案-广东康明节能空调有限公司 | 单螺旋速冻机-双螺旋-流态化-隧道式-食品速冻机厂家-广州冰泉制冷 | 非标压力容器_碳钢储罐_不锈钢_搪玻璃反应釜厂家-山东首丰智能环保装备有限公司 | 鲁网 - 山东省重点新闻网站,山东第一财经门户 | 长沙印刷厂-包装印刷-画册印刷厂家-湖南省日大彩色印务有限公司 青州搬家公司电话_青州搬家公司哪家好「鸿喜」青州搬家 | 正压送风机-多叶送风口-板式排烟口-德州志诺通风设备 | 北京晚会活动策划|北京节目录制后期剪辑|北京演播厅出租租赁-北京龙视星光文化传媒有限公司 | 废气处理_废气处理设备_工业废气处理_江苏龙泰环保设备制造有限公司 | 济南电缆桥架|山东桥架-济南航丰实业有限公司 | 硬质合金模具_硬质合金非标定制_硬面加工「生产厂家」-西迪技术股份有限公司 | 北京遮阳网-防尘盖土网-盖土草坪-迷彩网-防尘网生产厂家-京兴科技 |