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

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

    1. <tfoot id='dpK4E'></tfoot>

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

          <bdo id='dpK4E'></bdo><ul id='dpK4E'></ul>
        <legend id='dpK4E'><style id='dpK4E'><dir id='dpK4E'><q id='dpK4E'></q></dir></style></legend>

      1. sql server 上的 XML 解析

        XML Parsing on sql server(sql server 上的 XML 解析)
          <i id='69mPn'><tr id='69mPn'><dt id='69mPn'><q id='69mPn'><span id='69mPn'><b id='69mPn'><form id='69mPn'><ins id='69mPn'></ins><ul id='69mPn'></ul><sub id='69mPn'></sub></form><legend id='69mPn'></legend><bdo id='69mPn'><pre id='69mPn'><center id='69mPn'></center></pre></bdo></b><th id='69mPn'></th></span></q></dt></tr></i><div class="8jthywf" id='69mPn'><tfoot id='69mPn'></tfoot><dl id='69mPn'><fieldset id='69mPn'></fieldset></dl></div>

          <small id='69mPn'></small><noframes id='69mPn'>

          <legend id='69mPn'><style id='69mPn'><dir id='69mPn'><q id='69mPn'></q></dir></style></legend>
            <bdo id='69mPn'></bdo><ul id='69mPn'></ul>

                  <tbody id='69mPn'></tbody>
                  <tfoot id='69mPn'></tfoot>
                1. 本文介紹了sql server 上的 XML 解析的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  限時(shí)送ChatGPT賬號..

                  如何以格式返回?cái)?shù)據(jù):

                  Column Name t01     t02     t03     t04
                  Data        c01     c02     c03     c04
                  
                  <orders xmlns="www address">
                      <order>
                          <order-date>2019-09-05</order-date>
                          <created-by>storefront</created-by>
                          <original-order-no>000001</original-order-no>
                          <currency>USD</currency>
                          <taxation>gross</taxation>
                          <invoice-no>0099999</invoice-no>
                          <custom-attributes>
                              <custom-attribute attribute-id="t01">c01</custom-attribute>
                              <custom-attribute attribute-id="t02">c02</custom-attribute>
                              <custom-attribute attribute-id="t03">c03</custom-attribute>
                              <custom-attribute attribute-id="t04">c04</custom-attribute>
                          </custom-attributes>    
                      </order>
                  </orders>
                  

                  推薦答案

                  從你的問題來看,有一點(diǎn)不清楚:輸出列的命名.

                  From your question there's one thing not clear: The naming of the output columns.

                  在您預(yù)期的輸出中,它們的名稱與它們的 attribute-id 一樣.但在您的評論中,聽起來像是您選擇了前 4 個(gè)屬性,而您想忽略其余屬性.

                  In your expected output they are named like their attribute-id. But in your comments it sounds, like you are picking the first 4 attributes and you want to omit the rest.

                  我想展示兩種方法,選擇你更喜歡的一種:

                  I want to show two approaches, pick the one you like more:

                  DECLARE @mockupTable TABLE(ID INT IDENTITY, YourXml XML);
                  INSERT INTO @mockupTable VALUES
                  (N'<orders xmlns="www address">
                      <order>
                          <order-date>2019-09-05</order-date>
                          <created-by>storefront</created-by>
                          <original-order-no>000001</original-order-no>
                          <currency>USD</currency>
                          <taxation>gross</taxation>
                          <invoice-no>0099999</invoice-no>
                          <custom-attributes>
                              <custom-attribute attribute-id="t01">c01</custom-attribute>
                              <custom-attribute attribute-id="t02">c02</custom-attribute>
                              <custom-attribute attribute-id="t03">c03</custom-attribute>
                              <custom-attribute attribute-id="t04">c04</custom-attribute>
                          </custom-attributes>    
                      </order>
                  </orders>');
                  

                  --此查詢將使用 attribute-id 選擇相應(yīng)的屬性.
                  --我們可以使用相同的名稱安全地返回它
                  --如果你的XML沒有對應(yīng)的屬性,就會出現(xiàn)NULL值

                  --This query will use the attribute-id to pick the corresponding attribute.
                  --We can savely return this with the same name
                  --If your XML does not have the corresponding attribute, there will be a NULL value

                  WITH XMLNAMESPACES(DEFAULT 'www address')
                  SELECT o.value('(order-date/text())[1]','date') OrderDate
                        --As in your other questions
                        ,o.value('(custom-attributes/custom-attribute[@attribute-id="t01"]/text())[1]','varchar(100)') AS t01 
                        ,o.value('(custom-attributes/custom-attribute[@attribute-id="t02"]/text())[1]','varchar(100)') AS t02
                        ,o.value('(custom-attributes/custom-attribute[@attribute-id="t03"]/text())[1]','varchar(100)') AS t03 
                        ,o.value('(custom-attributes/custom-attribute[@attribute-id="t04"]/text())[1]','varchar(100)') AS t04 
                  FROM @mockupTable t
                  CROSS APPLY t.YourXml.nodes('/orders/order') A(o);
                  

                  --這個(gè)比較容易.它只會選擇前四個(gè)屬性,無論它們有什么 id.

                  --This one is easier. It will pick just the first four attributes, no matter what id they have.

                  WITH XMLNAMESPACES(DEFAULT 'www address')
                  SELECT o.value('(order-date/text())[1]','date') OrderDate
                        --As in your other questions
                        ,o.value('(custom-attributes/custom-attribute[1]/text())[1]','varchar(100)') AS ca1 
                        ,o.value('(custom-attributes/custom-attribute[2]/text())[1]','varchar(100)') AS ca2
                        ,o.value('(custom-attributes/custom-attribute[3]/text())[1]','varchar(100)') AS ca3 
                        ,o.value('(custom-attributes/custom-attribute[4]/text())[1]','varchar(100)') AS ca4 
                  FROM @mockupTable t
                  CROSS APPLY t.YourXml.nodes('/orders/order') A(o);
                  

                  這篇關(guān)于sql server 上的 XML 解析的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 實(shí)例使用的空間嗎?) - IT屋-程序員軟件開發(fā)
                  How to create a login to a SQL Server instance?(如何創(chuàng)建對 SQL Server 實(shí)例的登錄?)
                  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)換錯(cuò)誤?使用 ExecuteNonQuery()?)
                  How to show an image from a DataGridView to a PictureBox?(如何將 DataGridView 中的圖像顯示到 PictureBox?)
                  <i id='AMGCa'><tr id='AMGCa'><dt id='AMGCa'><q id='AMGCa'><span id='AMGCa'><b id='AMGCa'><form id='AMGCa'><ins id='AMGCa'></ins><ul id='AMGCa'></ul><sub id='AMGCa'></sub></form><legend id='AMGCa'></legend><bdo id='AMGCa'><pre id='AMGCa'><center id='AMGCa'></center></pre></bdo></b><th id='AMGCa'></th></span></q></dt></tr></i><div class="yjlvvdi" id='AMGCa'><tfoot id='AMGCa'></tfoot><dl id='AMGCa'><fieldset id='AMGCa'></fieldset></dl></div>
                    <tbody id='AMGCa'></tbody>
                      • <bdo id='AMGCa'></bdo><ul id='AMGCa'></ul>

                            <tfoot id='AMGCa'></tfoot><legend id='AMGCa'><style id='AMGCa'><dir id='AMGCa'><q id='AMGCa'></q></dir></style></legend>

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

                            主站蜘蛛池模板: 压砖机_电动螺旋压力机_粉末成型压力机_郑州华隆机械tel_0371-60121717 | 便民信息网_家电维修,家电清洗,开锁换锁,本地家政公司 | 云南外加剂,云南速凝剂,云南外加剂代加工-普洱澜湄新材料科技有限公司 | 便携式表面粗糙度仪-彩屏硬度计-分体式粗糙度仪-北京凯达科仪科技有限公司 | 超声波破碎仪-均质乳化机(供应杭州,上海,北京,广州,深圳,成都等地)-上海沪析实业有限公司 | 吊篮式|移动式冷热冲击试验箱-二槽冷热冲击试验箱-广东科宝 | 电缆接头_防水接头_电缆防水接头_防水电缆接头_上海闵彬 | 济南菜鸟驿站广告|青岛快递车车体|社区媒体-抖音|墙体广告-山东揽胜广告传媒有限公司 | 尊享蟹太太美味,大闸蟹礼卡|礼券|礼盒在线预订-蟹太太官网 | 恒温恒湿试验箱厂家-高低温试验箱维修价格_东莞环仪仪器_东莞环仪仪器 | 中国品牌排名投票_十大品牌榜单_中国著名品牌【中国品牌榜】 | 冷却塔减速机器_冷却塔皮带箱维修厂家_凉水塔风机电机更换-广东康明冷却塔厂家 | 搅拌磨|搅拌球磨机|循环磨|循环球磨机-无锡市少宏粉体科技有限公司 | 盘扣式脚手架-附着式升降脚手架-移动脚手架,专ye承包服务商 - 苏州安踏脚手架工程有限公司 | 潜水搅拌机-双曲面搅拌机-潜水推进器|奥伯尔环保| 河南不锈钢水箱_地埋水箱_镀锌板水箱_消防水箱厂家-河南联固供水设备有限公司 | 优宝-汽车润滑脂-轴承润滑脂-高温齿轮润滑油脂厂家 | Copeland/谷轮压缩机,谷轮半封闭压缩机,谷轮涡旋压缩机,型号规格,技术参数,尺寸图片,价格经销商 CTP磁天平|小电容测量仪|阴阳极极化_双液系沸点测定仪|dsj电渗实验装置-南京桑力电子设备厂 | 上海小程序开发-小程序制作-上海小程序定制开发公司-微信商城小程序-上海咏熠 | 挤塑板-XPS挤塑板-挤塑板设备厂家[襄阳欧格]| 酒精检测棒,数显温湿度计,酒安酒精测试仪,酒精检测仪,呼气式酒精检测仪-郑州欧诺仪器有限公司 | 裹包机|裹膜机|缠膜机|绕膜机-上海晏陵智能设备有限公司 | 四探针电阻率测试仪-振实密度仪-粉末流动性测定仪-宁波瑞柯微智能 | 超细|超微气流粉碎机|气流磨|气流分级机|粉体改性机|磨粉机|粉碎设备-山东埃尔派粉体科技 | 色谱柱-淋洗液罐-巴罗克试剂槽-巴氏吸管-5ml样品瓶-SBS液氮冻存管-上海希言科学仪器有限公司 | 浙江红酒库-冰雕库-气调库-茶叶库安装-医药疫苗冷库-食品物流恒温恒湿车间-杭州领顺实业有限公司 | 耐热钢-耐磨钢-山东聚金合金钢铸造有限公司 | 洛阳防爆合格证办理-洛阳防爆认证机构-洛阳申请国家防爆合格证-洛阳本安防爆认证代办-洛阳沪南抚防爆电气技术服务有限公司 | 杰福伦_磁致伸缩位移传感器_线性位移传感器-意大利GEFRAN杰福伦-河南赉威液压科技有限公司 | 呼末二氧化碳|ETCO2模块采样管_气体干燥管_气体过滤器-湖南纳雄医疗器械有限公司 | 不锈钢反应釜,不锈钢反应釜厂家-价格-威海鑫泰化工机械有限公司 不干胶标签-不干胶贴纸-不干胶标签定制-不干胶标签印刷厂-弗雷曼纸业(苏州)有限公司 | 次氯酸钠厂家,涉水级次氯酸钠,三氯化铁生产厂家-淄博吉灿化工 | 工业胀紧套_万向节联轴器_链条-规格齐全-型号选购-非标订做-厂家批发价格-上海乙谛精密机械有限公司 | 抖音短视频运营_企业网站建设_网络推广_全网自媒体营销-东莞市凌天信息科技有限公司 | 辊道窑炉,辊道窑炉厂家-山东艾希尔| 外贮压-柜式-悬挂式-七氟丙烷-灭火器-灭火系统-药剂-价格-厂家-IG541-混合气体-贮压-非贮压-超细干粉-自动-灭火装置-气体灭火设备-探火管灭火厂家-东莞汇建消防科技有限公司 | 湖南教师资格网-湖南教师资格证考试网 | 超声波气象站_防爆气象站_空气质量监测站_负氧离子检测仪-风途物联网 | 德州网站制作 - 网站建设设计 - seo排名优化 -「两山建站」 | 玻璃钢型材_拉挤模具_玻璃钢拉挤设备——滑县康百思 | 超声波流量计_流量标准装置生产厂家 _河南盛天精密测控 |