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. 主站蜘蛛池模板: hdpe土工膜-防渗膜-复合土工膜-长丝土工布价格-厂家直销「恒阳新材料」-山东恒阳新材料有限公司 ETFE膜结构_PTFE膜结构_空间钢结构_膜结构_张拉膜_浙江萬豪空间结构集团有限公司 | 西门子代理商_西门子变频器总代理-翰粤百科 | 衬四氟_衬氟储罐_四氟储罐-无锡市氟瑞特防腐科技有限公司 | RTO换向阀_VOC高温阀门_加热炉切断阀_双偏心软密封蝶阀_煤气蝶阀_提升阀-湖北霍科德阀门有限公司 | 小型玉石雕刻机_家用玉雕机_小型万能雕刻机_凡刻雕刻机官网 | 除尘器布袋骨架,除尘器滤袋,除尘器骨架,电磁脉冲阀膜片,卸灰阀,螺旋输送机-泊头市天润环保机械设备有限公司 | 合肥升降机-合肥升降货梯-安徽升降平台「厂家直销」-安徽鼎升自动化科技有限公司 | 双能x射线骨密度检测仪_dxa骨密度仪_双能x线骨密度仪_品牌厂家【品源医疗】 | 防弹玻璃厂家_防爆炸玻璃_电磁屏蔽玻璃-四川大硅特玻科技有限公司 | 四川成人高考_四川成考报名网| 茶楼装修设计_茶馆室内设计效果图_云臻轩茶楼装饰公司 | 汽车水泵_汽车水泵厂家-瑞安市骏迪汽车配件有限公司 | 碳化硅,氮化硅,冰晶石,绢云母,氟化铝,白刚玉,棕刚玉,石墨,铝粉,铁粉,金属硅粉,金属铝粉,氧化铝粉,硅微粉,蓝晶石,红柱石,莫来石,粉煤灰,三聚磷酸钠,六偏磷酸钠,硫酸镁-皓泉新材料 | 工业车间焊接-整体|集中除尘设备-激光|等离子切割机配套除尘-粉尘烟尘净化治理厂家-山东美蓝环保科技有限公司 | 除甲醛公司-甲醛检测治理-杭州创绿家环保科技有限公司-室内空气净化十大品牌 | 沈阳楼承板_彩钢板_压型钢板厂家-辽宁中盛绿建钢品股份有限公司 轴承振动测量仪电箱-轴承测振动仪器-测试仪厂家-杭州居易电气 | 深圳市东信高科自动化设备有限公司| 连续油炸机,全自动油炸机,花生米油炸机-烟台茂源食品机械制造有限公司 | 手持式线材张力计-套帽式风量罩-深圳市欧亚精密仪器有限公司 | 直齿驱动-新型回转驱动和回转支承解决方案提供商-不二传动 | 水热合成反应釜-防爆高压消解罐-西安常仪仪器设备有限公司 | 发光字|标识设计|标牌制作|精神堡垒 - 江苏苏通广告有限公司 | 挤奶设备过滤纸,牛奶过滤纸,挤奶机过滤袋-济南蓝贝尔工贸有限公司 | 无味渗透剂,泡沫抑尘剂,烷基糖苷-威海威能化工有限公司 | 量子管通环-自清洗过滤器-全自动反冲洗过滤器-北京罗伦过滤技术集团有限公司 | 防火板_饰面耐火板价格、厂家_品牌认准格林雅 | 众品地板网-地板品牌招商_地板装修设计_地板门户的首选网络媒体。 | 扒渣机,铁水扒渣机,钢水扒渣机,铁水捞渣机,钢水捞渣机-烟台盛利达工程技术有限公司 | 珠海网站建设_响应网站建设_珠海建站公司_珠海网站设计与制作_珠海网讯互联 | 药品/药物稳定性试验考察箱-埃里森仪器设备(上海)有限公司 | 密度电子天平-内校-外校电子天平-沈阳龙腾电子有限公司 | 背压阀|减压器|不锈钢减压器|减压阀|卫生级背压阀|单向阀|背压阀厂家-上海沃原自控阀门有限公司 本安接线盒-本安电路用接线盒-本安分线盒-矿用电话接线盒-JHH生产厂家-宁波龙亿电子科技有限公司 | 防腐木批发价格_深圳_惠州_东莞防腐木厂家_森源(深圳)防腐木有限公司 | 塑料脸盆批发,塑料盆生产厂家,临沂塑料广告盆,临沂家用塑料盆-临沂市永顺塑业 | 东莞螺杆空压机_永磁变频空压机_节能空压机_空压机工厂批发_深圳螺杆空压机_广州螺杆空压机_东莞空压机_空压机批发_东莞空压机工厂批发_东莞市文颖设备科技有限公司 | 螺旋绞龙叶片,螺旋输送机厂家,山东螺旋输送机-淄博长江机械制造有限公司 | EDLC超级法拉电容器_LIC锂离子超级电容_超级电容模组_软包单体电容电池_轴向薄膜电力电容器_深圳佳名兴电容有限公司_JMX专注中高端品牌电容生产厂家 | 花纹铝板,合金铝卷板,阴极铝板-济南恒诚铝业有限公司 | 无线讲解器-导游讲解器-自助讲解器-分区讲解系统 品牌生产厂家[鹰米讲解-合肥市徽马信息科技有限公司] | 南京展台搭建-南京展会设计-南京展览设计公司-南京展厅展示设计-南京汇雅展览工程有限公司 | 上海logo设计|