久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    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="qwawimqqmiuu" 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="qwawimqqmiuu" 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的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送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)
                  

                  我的要求是獲取所有 , 并且帶有 Path nodes('Margins/Margin') AS X(N).到目前為止,我只得到下面這實際上是每個 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 數據 數據位于 .您需要通過 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);
                  

                  結果

                  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
                  

                  這篇關于XML 解析 - SQL Server的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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屋-程序員軟件開發
                  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?)

                      <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="qwawimqqmiuu" 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>
                            主站蜘蛛池模板: 蜜桃官网 | 欧洲国产精品视频 | 欧美精品乱码久久久久久按摩 | 亚洲精品中文字幕在线观看 | 激情六月丁香婷婷 | 波多野结衣一区二区 | 嫩草视频在线看 | 久久精品国产99国产 | 日韩欧美在线一区 | 亚洲人成人一区二区在线观看 | 成人影院一区二区三区 | 亚洲综合天堂 | h视频在线免费看 | 欧美一区二区三区免费电影 | 欧美亚洲一区二区三区 | 精品一区二区三区在线观看 | 日韩一区二区在线免费观看 | 国产高清在线精品 | 巨大荫蒂视频欧美另类大 | 成人久久久 | 97精品国产97久久久久久免费 | 精品综合久久久 | 欧美日韩在线观看视频 | 凹凸日日摸日日碰夜夜 | 精品国产一区二区在线 | 久久精品亚洲国产 | 国色天香成人网 | 久久伊人精品 | 亚洲精品一区在线观看 | 久草免费视 | 色综合久久天天综合网 | 亚洲精品成人 | 精品综合久久久 | 99精品免费 | 伊人电影院av | 久久成人国产精品 | 亚洲高清在线观看 | 欧美精品久久 | 在线观看成人精品 | 欧美成人一区二区三区 | 视频在线一区二区 |