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

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

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

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

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

        XML to SQL - 選擇多個(gè)同名節(jié)點(diǎn)

        XML to SQL - Selecting multiple nodes with the same name(XML to SQL - 選擇多個(gè)同名節(jié)點(diǎn))
          <tbody id='7CnjH'></tbody>

              <legend id='7CnjH'><style id='7CnjH'><dir id='7CnjH'><q id='7CnjH'></q></dir></style></legend>

                <small id='7CnjH'></small><noframes id='7CnjH'>

                <i id='7CnjH'><tr id='7CnjH'><dt id='7CnjH'><q id='7CnjH'><span id='7CnjH'><b id='7CnjH'><form id='7CnjH'><ins id='7CnjH'></ins><ul id='7CnjH'></ul><sub id='7CnjH'></sub></form><legend id='7CnjH'></legend><bdo id='7CnjH'><pre id='7CnjH'><center id='7CnjH'></center></pre></bdo></b><th id='7CnjH'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='7CnjH'><tfoot id='7CnjH'></tfoot><dl id='7CnjH'><fieldset id='7CnjH'></fieldset></dl></div>
              1. <tfoot id='7CnjH'></tfoot>
                  <bdo id='7CnjH'></bdo><ul id='7CnjH'></ul>
                  本文介紹了XML to SQL - 選擇多個(gè)同名節(jié)點(diǎn)的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  限時(shí)送ChatGPT賬號(hào)..

                  我有可以從 XML 文件中選擇幾個(gè)值的工作代碼.問(wèn)題是我有多個(gè)同名的節(jié)點(diǎn).

                  I have working code that can select a few values from an XML file. The problem is that I have multiple nodes with the same name.

                  這是 XML 的一個(gè)片段:

                  Here is a snippet of the XML:

                  <wd:Report_Data xmlns:wd="urn:com.workday.report/Countries_and_Their_Address_Components_Summary">
                    <wd:Report_Entry>
                      <wd:Country wd:Descriptor="Afghanistan">
                        <wd:ID wd:type="WID">db69b722446c11de98360015c5e6daf6</wd:ID>
                        <wd:ID wd:type="ISO_3166-1_Alpha-2_Code">AF</wd:ID>
                        <wd:ID wd:type="ISO_3166-1_Alpha-3_Code">AFG</wd:ID>
                        <wd:ID wd:type="ISO_3166-1_Numeric-3_Code">4</wd:ID>
                      </wd:Country>
                      <wd:Address_Format_Type wd:Descriptor="Basic">
                        <wd:ID wd:type="WID">4516bf435611423ea4ee72fa842572a0</wd:ID>
                      </wd:Address_Format_Type>
                      <wd:Local>1</wd:Local>
                      <wd:Address_Components>
                        <wd:Address_Component wd:Descriptor="Address Line 1 - Local">
                          <wd:ID wd:type="WID">12d859b8df024175a111da2e088250fb</wd:ID>
                          <wd:ID wd:type="Address_Component_Type_ID">ADDRESS_LINE_1_LOCAL</wd:ID>
                        </wd:Address_Component>
                        <wd:Order>a</wd:Order>
                        <wd:Required>0</wd:Required>
                      </wd:Address_Components>
                      <wd:Address_Components>
                        <wd:Address_Component wd:Descriptor="Address Line 2 - Local">
                          <wd:ID wd:type="WID">85a6ab9412c44dd9a71a7e4760bf17fb</wd:ID>
                          <wd:ID wd:type="Address_Component_Type_ID">ADDRESS_LINE_2_LOCAL</wd:ID>
                        </wd:Address_Component>
                        <wd:Order>b</wd:Order>
                        <wd:Required>0</wd:Required>
                      </wd:Address_Components>
                  

                  我的 SQL 如下:

                  declare @inputxml table (x xml)
                  
                  insert @inputxml
                  select x
                  from OPENROWSET(BULK 'C:\ParallelTool\addcomp.xml', SINGLE_BLOB) As T(x)
                  
                  ;WITH XMLNAMESPACES(DEFAULT 'urn:com.workday.report/Countries_and_Their_Address_Components_Summary')
                      select 
                          xmldata.[ISO], xmldata.[Component 1], xmldata.[Component 2], xmldata.[Required]
                      into dbo.WD
                      from @inputxml
                      cross apply (
                          select 
                              [ISO] = xmldata.value('(Country/ID)[3]', 'VARCHAR(MAX)'),
                              [Component 1] = xmldata.value('(Address_Components/Address_Component/ID)[2]', 'VARCHAR(MAX)'),
                              [Component 2] = xmldata.value('(Address_Components/Address_Component/ID)[2]', 'VARCHAR(MAX)'),
                              [Required] = xmldata.value('(Address_Components/Required)[1]', 'INT')
                          from x.nodes('/Report_Data/Report_Entry') Z1(xmldata)
                      ) xmldata
                  

                  我無(wú)法得到我需要的是 [組件 2].我想基本上選擇文件中的所有Address_Component_Type_ID",但它們的名稱都相同,并且在名稱相同的其他節(jié)點(diǎn)下.如何在我的 SQL 中指定獲取所有組件類型?感謝您的關(guān)注!

                  Where I can't get what I need is the [Component 2]. I want to basically select ALL of the "Address_Component_Type_ID" in the file, but they are all named the same and under other nodes that are named the same. How can I specify in my SQL to grab all of the Component Types? Thank you for looking!

                  推薦答案

                  取決于您想要做什么...如果您知道正好有 2 個(gè)Address_Components"要抓取,您可以像這樣修改您的查詢:

                  Depends what you want to do... If you know there are exactly 2 "Address_Components" that you want to grab, you can modify your query like so:

                  ;WITH XMLNAMESPACES(DEFAULT 'urn:com.workday.report/Countries_and_Their_Address_Components_Summary')
                      select 
                          xmldata.[ISO], xmldata.[Component 1], xmldata.[Component 2], xmldata.[Required]
                      from @inputxml
                      cross apply (
                          select 
                              [ISO] = xmldata.value('(Country/ID)[3]', 'VARCHAR(MAX)'),
                              [Component 1] = xmldata.value('(Address_Components/Address_Component/ID)[2]', 'VARCHAR(MAX)'),
                              [Component 2] = xmldata.value('(Address_Components[2]/Address_Component/ID)[2]', 'VARCHAR(MAX)'),
                              [Required] = xmldata.value('(Address_Components/Required)[1]', 'INT')
                          from x.nodes('/Report_Data/Report_Entry') Z1(xmldata)
                      ) xmldata
                  

                  結(jié)果如下:

                  ISO   Component 1               Component 2               Required
                  ----- ------------------------- ------------------------- -----------
                  AFG   ADDRESS_LINE_1_LOCAL      ADDRESS_LINE_2_LOCAL      0
                  

                  但是,如果可以有任意數(shù)量的Address_Components",并且您想將它們抓取到單獨(dú)的記錄中,您可以像這樣重寫您的查詢:

                  However, if there can be any number of "Address_Components", and you want to grab them into separate records, you can rewrite your query like this:

                  ;WITH XMLNAMESPACES(DEFAULT 'urn:com.workday.report/Countries_and_Their_Address_Components_Summary')
                      select 
                          [ISO] = Report_Entry.x.value('(Country/ID)[3]', 'VARCHAR(MAX)')
                          , [Component] = Address_Components.x.value('(Address_Component/ID)[2]', 'VARCHAR(MAX)')
                          , [Required] = Address_Components.x.value('(Required)[1]', 'INT')
                      from @inputxml
                      cross apply x.nodes('/Report_Data/Report_Entry') Report_Entry(x)
                      cross apply Report_Entry.x.nodes('./Address_Components') Address_Components (x)
                  

                  結(jié)果如下:

                  ISO   Component                 Required
                  ----- ------------------------- -----------
                  AFG   ADDRESS_LINE_1_LOCAL      0
                  AFG   ADDRESS_LINE_2_LOCAL      0
                  

                  這篇關(guān)于XML to SQL - 選擇多個(gè)同名節(jié)點(diǎn)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(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ù)庫(kù)列表和 SQL Server 實(shí)例使用的空間嗎?) - IT屋-程序員軟件開(kāi)發(fā)
                  How to create a login to a SQL Server instance?(如何創(chuàng)建對(duì) SQL Server 實(shí)例的登錄?)
                  How to know the version and edition of SQL Server through registry search(如何通過(guò)注冊(cè)表搜索知道SQL Server的版本和版本)
                  Why do I get a quot;data type conversion errorquot; with ExecuteNonQuery()?(為什么會(huì)出現(xiàn)“數(shù)據(jù)類型轉(zhuǎn)換錯(cuò)誤?使用 ExecuteNonQuery()?)
                  How to show an image from a DataGridView to a PictureBox?(如何將 DataGridView 中的圖像顯示到 PictureBox?)

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

                      • <bdo id='aXCiN'></bdo><ul id='aXCiN'></ul>
                          <tbody id='aXCiN'></tbody>
                      • <legend id='aXCiN'><style id='aXCiN'><dir id='aXCiN'><q id='aXCiN'></q></dir></style></legend>

                          1. <tfoot id='aXCiN'></tfoot>
                            <i id='aXCiN'><tr id='aXCiN'><dt id='aXCiN'><q id='aXCiN'><span id='aXCiN'><b id='aXCiN'><form id='aXCiN'><ins id='aXCiN'></ins><ul id='aXCiN'></ul><sub id='aXCiN'></sub></form><legend id='aXCiN'></legend><bdo id='aXCiN'><pre id='aXCiN'><center id='aXCiN'></center></pre></bdo></b><th id='aXCiN'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='aXCiN'><tfoot id='aXCiN'></tfoot><dl id='aXCiN'><fieldset id='aXCiN'></fieldset></dl></div>
                          2. 主站蜘蛛池模板: 久久艳片www.17c.com | 黄色免费网 | 久久免费小视频 | 99精品成人 | 日韩欧美不卡 | 不卡的av网站 | 一区二区免费在线观看 | 婷婷狠狠| 黄色片在线观看视频 | 精品少妇| 男女av网站| 国产成年人视频 | 日韩一级视频 | 亚洲欧美综合网 | 国产理论片在线观看 | av在线播放不卡 | 天天操天天操天天操 | 天堂网av在线| 欧美a视频 | 精品国产欧美一区二区三区成人 | 草逼com | a在线免费观看 | 2018天天操| 欧美一区二区三区在线 | av激情影院 | 91色国产| 欧美激情国产精品 | 麻豆chinese新婚xxx | 国产第五页 | 蜜臀久久99精品久久久久久宅男 | 亚洲区在线| 日本免费一级片 | 在线免费观看av网站 | 欧美一级片在线观看 | 国产特黄| 成人免费在线播放 | 国产日韩一区二区三区 | 欧美综合色 | 亚洲国产精品久久久久 | 久久日本 | 久久久夜色精品 |