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

    1. <small id='yySIq'></small><noframes id='yySIq'>

    2. <i id='yySIq'><tr id='yySIq'><dt id='yySIq'><q id='yySIq'><span id='yySIq'><b id='yySIq'><form id='yySIq'><ins id='yySIq'></ins><ul id='yySIq'></ul><sub id='yySIq'></sub></form><legend id='yySIq'></legend><bdo id='yySIq'><pre id='yySIq'><center id='yySIq'></center></pre></bdo></b><th id='yySIq'></th></span></q></dt></tr></i><div class="5z3zlrt" id='yySIq'><tfoot id='yySIq'></tfoot><dl id='yySIq'><fieldset id='yySIq'></fieldset></dl></div>

      <tfoot id='yySIq'></tfoot>
        <bdo id='yySIq'></bdo><ul id='yySIq'></ul>

        <legend id='yySIq'><style id='yySIq'><dir id='yySIq'><q id='yySIq'></q></dir></style></legend>

        XML 解析 - SQL Server

        XML Parsing - SQL Server(XML 解析 - SQL Server)

          <legend id='C90EQ'><style id='C90EQ'><dir id='C90EQ'><q id='C90EQ'></q></dir></style></legend>
            <tbody id='C90EQ'></tbody>

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

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

                  <bdo id='C90EQ'></bdo><ul id='C90EQ'></ul>
                  <tfoot id='C90EQ'></tfoot>

                  本文介紹了XML 解析 - SQL Server的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我有一個如下所示的 XML:

                  I have an XML that looks like below:

                  declare @xml xml = '<Margins >
                  <Margin type="type1" currencyCode="currencyCode1">
                    <MarginRevenue>1.1</MarginRevenue>
                    <MarginRevenue>1.2</MarginRevenue>
                    <MarginRevenue>1.3</MarginRevenue>
                    <MarginCost>2.1</MarginCost>
                    <MarginCost>2.2</MarginCost>
                    <MarginCost>2.3</MarginCost>
                    <MarginValue>3.1</MarginValue>
                    <MarginValue>3.2</MarginValue>
                    <MarginValue>3.3</MarginValue>
                  </Margin>
                  <Margin type="type2" currencyCode="currencyCode2">
                    <MarginRevenue>1.4</MarginRevenue>
                    <MarginRevenue>1.5</MarginRevenue>
                    <MarginRevenue>1.6</MarginRevenue>
                    <MarginCost>2.4</MarginCost>
                    <MarginCost>2.5</MarginCost>
                    <MarginCost>2.6</MarginCost>
                    <MarginValue>3.4</MarginValue>
                    <MarginValue>3.5</MarginValue>
                    <MarginValue>3.6</MarginValue>
                  </Margin>
                  <Margin type="type3" currencyCode="currencyCode3">
                    <MarginRevenue>1.7</MarginRevenue>
                    <MarginRevenue>1.8</MarginRevenue>
                    <MarginRevenue>1.9</MarginRevenue>
                    <MarginCost>2.7</MarginCost>
                    <MarginCost>2.8</MarginCost>
                    <MarginCost>2.9</MarginCost>
                    <MarginValue>3.7</MarginValue>
                    <MarginValue>3.8</MarginValue>
                    <MarginValue>3.9</MarginValue>
                  </Margin>
                  

                  '

                  SELECT
                  [Margin_Revenue] = N.value('(MarginRevenue)[1]', 'decimal(15,5)')
                  ,[Margin_Cost] = N.value('(MarginCost)[1]', 'decimal(15,5)')
                  ,[Margin_Value] = N.value('(MarginValue)[1]', 'decimal(15,5)')
                  FROM
                  @xml.nodes('Margins/Margin') AS X(N)
                  

                  我的要求是獲取所有 , 并且?guī)в?Path nodes('Margins/Margin') AS X(N).到目前為止,我只得到下面這實(shí)際上是每個 Margin 的第一條記錄:

                  My requirement is to get all the , and but with Path nodes('Margins/Margin') AS X(N). As of now, I'm getting below only which is actually the first record of each Margin:

                      Margin_Revenue  Margin_Cost  Margin_Value
                      1.10000         2.10000      3.10000
                      1.40000         2.40000      3.40000
                      1.70000         2.70000      3.70000
                  

                  推薦答案

                  1:n 處有 1:n 數(shù)據(jù) 數(shù)據(jù)位于 .您需要通過 APPLY 使用 .nodes() 兩次.

                  There is 1:n data at <Margin> and again 1:n data at <MarginRevenue>. You need to use .nodes() twice via APPLY.

                  declare @xml xml = '<Margins>
                      <Margin type="type1" currencyCode="currencyCode1">
                        <MarginRevenue>1.1</MarginRevenue>
                        <MarginRevenue>1.2</MarginRevenue>
                        <MarginRevenue>1.3</MarginRevenue>
                      </Margin>
                      <Margin type="type2" currencyCode="currencyCode2">
                        <MarginRevenue>1.4</MarginRevenue>
                        <MarginRevenue>1.5</MarginRevenue>
                        <MarginRevenue>1.6</MarginRevenue>
                      </Margin>
                      <Margin type="type3" currencyCode="currencyCode3">
                        <MarginRevenue>1.7</MarginRevenue>
                        <MarginRevenue>1.8</MarginRevenue>
                        <MarginRevenue>1.9</MarginRevenue>
                        </Margin>
                      </Margins>'
                  
                  SELECT
                   [Margin_Type]         = Marg.value('@type', 'varchar(100)') 
                  ,[Margin_currencyCode] = Marg.value('@currencyCode', 'varchar(100)')
                  ,[Revenue_Value]       = Rev.value('text()[1]','decimal(15,5)') 
                  FROM
                  @xml.nodes('Margins/Margin') AS A(Marg)
                  OUTER APPLY Marg.nodes('MarginRevenue') B(Rev);
                  

                  結(jié)果

                  Type    currencyCode    Revenue_Value
                  -------------------------------------
                  type1   currencyCode1   1.10000
                  type1   currencyCode1   1.20000
                  type1   currencyCode1   1.30000
                  type2   currencyCode2   1.40000
                  type2   currencyCode2   1.50000
                  type2   currencyCode2   1.60000
                  type3   currencyCode3   1.70000
                  type3   currencyCode3   1.80000
                  type3   currencyCode3   1.90000
                  

                  這篇關(guān)于XML 解析 - SQL Server的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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)換錯誤?使用 ExecuteNonQuery()?)
                  How to show an image from a DataGridView to a PictureBox?(如何將 DataGridView 中的圖像顯示到 PictureBox?)

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

                              <tbody id='3izIS'></tbody>

                            <small id='3izIS'></small><noframes id='3izIS'>

                          • <legend id='3izIS'><style id='3izIS'><dir id='3izIS'><q id='3izIS'></q></dir></style></legend>
                            主站蜘蛛池模板: 泰国试管婴儿_泰国第三代试管婴儿_泰国试管婴儿费用/多少钱_孕泰来 | BAUER减速机|ROSSI-MERSEN熔断器-APTECH调压阀-上海爱泽工业设备有限公司 | 高防护蠕动泵-多通道灌装系统-高防护蠕动泵-www.bjhuiyufluid.com慧宇伟业(北京)流体设备有限公司 | SMC-SMC电磁阀-日本SMC气缸-SMC气动元件展示网 | 精密五金冲压件_深圳五金冲压厂_钣金加工厂_五金模具加工-诚瑞丰科技股份有限公司 | ◆大型吹塑加工|吹塑加工|吹塑代加工|吹塑加工厂|吹塑设备|滚塑加工|滚塑代加工-莱力奇塑业有限公司 | 通信天线厂家_室分八木天线_对数周期天线_天线加工厂_林创天线源头厂家 | 东莞工厂厂房装修_无尘车间施工_钢结构工程安装-广东集景建筑装饰设计工程有限公司 | 中央空调维修、中央空调保养、螺杆压缩机维修-苏州东菱空调 | 淬火设备-钎焊机-熔炼炉-中频炉-锻造炉-感应加热电源-退火机-热处理设备-优造节能 | 东莞工厂厂房装修_无尘车间施工_钢结构工程安装-广东集景建筑装饰设计工程有限公司 | 水轮机密封网 | 水轮机密封产品研发生产厂家| 岩棉板|岩棉复合板|聚氨酯夹芯板|岩棉夹芯板|彩钢夹芯板-江苏恒海钢结构 | 背压阀|减压器|不锈钢减压器|减压阀|卫生级背压阀|单向阀|背压阀厂家-上海沃原自控阀门有限公司 本安接线盒-本安电路用接线盒-本安分线盒-矿用电话接线盒-JHH生产厂家-宁波龙亿电子科技有限公司 | 锯边机,自动锯边机,双面涂胶机-建业顺达机械有限公司 | 北京征地律师,征地拆迁律师,专业拆迁律师,北京拆迁律师,征地纠纷律师,征地诉讼律师,征地拆迁补偿,拆迁律师 - 北京凯诺律师事务所 | 食品级焦亚硫酸钠_工业级焦亚硫酸钠_焦亚硫酸钠-潍坊邦华化工有限公司 | 根系分析仪,大米外观品质检测仪,考种仪,藻类鉴定计数仪,叶面积仪,菌落计数仪,抑菌圈测量仪,抗生素效价测定仪,植物表型仪,冠层分析仪-杭州万深检测仪器网 | 镀锌角钢_槽钢_扁钢_圆钢_方矩管厂家_镀锌花纹板-海邦钢铁(天津)有限公司 | 深圳侦探联系方式_深圳小三调查取证公司_深圳小三分离机构 | 高通量组织研磨仪-多样品组织研磨仪-全自动组织研磨仪-研磨者科技(广州)有限公司 | 肉嫩度仪-凝胶测试仪-国产质构仪-气味分析仪-上海保圣实业发展有限公司|总部 | 干粉砂浆设备_干混砂浆生产线_腻子粉加工设备_石膏抹灰砂浆生产成套设备厂家_干粉混合设备_砂子烘干机--郑州铭将机械设备有限公司 | 合肥办公室装修 - 合肥工装公司 - 天思装饰 | 拉卡拉POS机官网 - 官方直营POS机办理|在线免费领取 | 拉力测试机|材料拉伸试验机|电子拉力机价格|万能试验机厂家|苏州皖仪实验仪器有限公司 | 钢结构-钢结构厂房-钢结构工程[江苏海逵钢构厂] | 济南玻璃安装_济南玻璃门_济南感应门_济南玻璃隔断_济南玻璃门维修_济南镜片安装_济南肯德基门_济南高隔间-济南凯轩鹏宇玻璃有限公司 | hdpe土工膜-防渗膜-复合土工膜-长丝土工布价格-厂家直销「恒阳新材料」-山东恒阳新材料有限公司 ETFE膜结构_PTFE膜结构_空间钢结构_膜结构_张拉膜_浙江萬豪空间结构集团有限公司 | 铝机箱_铝外壳加工_铝外壳厂家_CNC散热器加工-惠州市铂源五金制品有限公司 | 雄松华章(广州华章MBA)官网-专注MBA/MPA/MPAcc/MEM辅导培训 | 六维力传感器_六分量力传感器_模腔压力传感器-南京数智微传感科技有限公司 | 丹佛斯变频器-丹佛斯压力开关-变送器-广州市风华机电设备有限公司 | 粉末冶金注射成型厂家|MIM厂家|粉末冶金齿轮|MIM零件-深圳市新泰兴精密科技 | 天津货架厂_穿梭车货架_重型仓储货架_阁楼货架定制-天津钢力仓储货架生产厂家_天津钢力智能仓储装备 | 广域铭岛Geega(际嘉)工业互联网平台-以数字科技引领行业跃迁 | 不锈钢反应釜,不锈钢反应釜厂家-价格-威海鑫泰化工机械有限公司 不干胶标签-不干胶贴纸-不干胶标签定制-不干胶标签印刷厂-弗雷曼纸业(苏州)有限公司 | 二维运动混料机,加热型混料机,干粉混料机-南京腾阳干燥设备厂 | 硬齿面减速机[型号全],ZQ减速机-淄博久增机械 | 聚合氯化铝_喷雾聚氯化铝_聚合氯化铝铁厂家_郑州亿升化工有限公司 | 釜溪印象网络 - Powered by Discuz! |