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

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

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

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

      • <bdo id='dpUgK'></bdo><ul id='dpUgK'></ul>
      <tfoot id='dpUgK'></tfoot>

    1. 將具有相同標(biāo)記的 XML 值分成不同的行 SQL Server

      Separating XML values with the same tags into different rows SQL Server(將具有相同標(biāo)記的 XML 值分成不同的行 SQL Server)

          <tfoot id='3O4eA'></tfoot>
        1. <legend id='3O4eA'><style id='3O4eA'><dir id='3O4eA'><q id='3O4eA'></q></dir></style></legend>
            • <i id='3O4eA'><tr id='3O4eA'><dt id='3O4eA'><q id='3O4eA'><span id='3O4eA'><b id='3O4eA'><form id='3O4eA'><ins id='3O4eA'></ins><ul id='3O4eA'></ul><sub id='3O4eA'></sub></form><legend id='3O4eA'></legend><bdo id='3O4eA'><pre id='3O4eA'><center id='3O4eA'></center></pre></bdo></b><th id='3O4eA'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='3O4eA'><tfoot id='3O4eA'></tfoot><dl id='3O4eA'><fieldset id='3O4eA'></fieldset></dl></div>
                <bdo id='3O4eA'></bdo><ul id='3O4eA'></ul>
                  <tbody id='3O4eA'></tbody>
              • <small id='3O4eA'></small><noframes id='3O4eA'>

                本文介紹了將具有相同標(biāo)記的 XML 值分成不同的行 SQL Server的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                問(wèn)題描述

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

                我有一個(gè)要解析的 XML 文件.XML 是使用

                I have an XML File which I am trying to parse. The XML was created through Excel using

                另存為 XML

                因?yàn)?XML 文件是從 Microsoft Excel 創(chuàng)建的,所以它有這個(gè)標(biāo)題:

                Because the XML file was created from Microsoft Excel, it has this header:

                <?xml version="1.0"?>
                <?mso-application progid="Excel.Sheet"?>
                <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
                 xmlns:o="urn:schemas-microsoft-com:office:office"
                 xmlns:x="urn:schemas-microsoft-com:office:excel"
                 xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
                 xmlns:html="http://www.w3.org/TR/REC-html40">
                

                我試圖提取的數(shù)據(jù)是這樣設(shè)置的:

                The data I am trying to extract is set up in blocks like this:

                <Row ss:AutoFitHeight="0" ss:Height="30">
                    <Cell ss:StyleID="s22"/>
                    <Cell ss:StyleID="s24"><Data ss:Type="String">Jane Doe</Data></Cell>
                    <Cell ss:StyleID="s24"><Data ss:Type="String">JaneDoe</Data></Cell>
                    <Cell ss:StyleID="s24"><Data ss:Type="String">XYZ</Data></Cell>
                    <Cell ss:StyleID="s24"><Data ss:Type="String">(555) 555-5555</Data></Cell>
                    <Cell ss:StyleID="s22"/>
                   </Row>
                

                現(xiàn)在,我的查詢?nèi)缦滤?

                Right now, my query looks like this:

                ;WITH XMLNAMESPACES ('urn:schemas-microsoft-com:office:spreadsheet' as ss)
                
                select * from (
                select X.value('local-name(.)[1]','varchar(max)') as Name,
                X.value('.[1]','varchar(max)') as Value
                from @allUsers.nodes('//*') as T(X)
                    ) a
                where Name  = 'Data'
                

                并給我這些結(jié)果:

                Name    Value
                ----    -----------
                Data    Jane Doe
                Data    JaneDoe
                Data    XYZ
                Data    (555)555-5555
                

                我想做的是將它分成 4 行,所以我有類似的東西:

                What I would like to do is separate this into 4 rows, so I have something like:

                Name      UserName    Address    Phone
                -----     ----------  ---------  ----------
                Jane Doe  JaneDoe     XYZ        (555)-555-5555
                

                我嘗試選擇一列作為

                X.value('.[2]','varchar(max)') as UserName
                

                但我只是得到了所有的 NULL 值.

                but I just get all NULL values for that.

                有沒(méi)有辦法做到這一點(diǎn)?

                Is there any way to do this?

                XML 文件的一般結(jié)構(gòu)如下:

                The general structure of the XML file looks like:

                <Workbook>
                  <DocumentProperties>
                  </DocumentProperties>
                  <ExcelWorkbook>
                  </ExcelWorkbook>
                  <Styles>
                    <Style>
                    </Style>
                  </Styles>
                  <Worksheet>
                    <Table>
                      <Column.../>
                      <Column.../>
                      <Column.../>
                      <Row>
                        <Cell.../>
                        <Cell><Data>...</Data></Cell>
                        <Cell><Data>...</Data></Cell>
                        <Cell><Data>...</Data></Cell>
                        <Cell><Data>...</Data></Cell>
                        <Cell.../>
                      </Row>
                      ...
                    </Table>
                  </Worksheet>
                

                我想要獲取的信息在 ...</Data> 字段

                and the information I am trying to get is in the <Data>...</Data> field

                編輯

                從我表述這個(gè)問(wèn)題的方式來(lái)看,標(biāo)題名稱似乎已經(jīng)被編入,但它們實(shí)際上被讀取為 <;/Cell>.我也不確定這部分的用途是什么

                From the way I phrased the question, it would seem like the header names are already programmed in, but they are actually read as rows in <Cell><Data><Data/></Cell>. I am also not sure what purpose the part serves

                這是部分的開始:

                <Table ss:ExpandedColumnCount="6" ss:ExpandedRowCount="2685" x:FullColumns="1"
                   x:FullRows="1">
                   <Column ss:AutoFitWidth="0" ss:Width="26.25"/>
                   <Column ss:AutoFitWidth="0" ss:Width="117" ss:Span="3"/>
                   <Column ss:Index="6" ss:AutoFitWidth="0" ss:Width="29.25"/>
                   <Row ss:AutoFitHeight="0" ss:Height="60"> --Contains the header names
                    <Cell ss:StyleID="s22"/>
                    <Cell ss:StyleID="s23"><Data ss:Type="String">Name</Data></Cell>
                    <Cell ss:StyleID="s23"><Data ss:Type="String">UserName</Data></Cell>
                    <Cell ss:StyleID="s23"><Data ss:Type="String">Address</Data></Cell>
                    <Cell ss:StyleID="s23"><Data ss:Type="String">Telephone Number</Data></Cell>
                    <Cell ss:StyleID="s22"/>
                   </Row>
                
                   <Row ss:AutoFitHeight="0" ss:Height="30"> --First record I would like to extract
                    <Cell ss:StyleID="s22"/>
                    <Cell ss:StyleID="s24"><Data ss:Type="String">John Smith</Data></Cell>
                    <Cell ss:StyleID="s24"><Data ss:Type="String">JSmith</Data></Cell>
                    <Cell ss:StyleID="s24"><Data ss:Type="String">ABC</Data></Cell>
                    <Cell ss:StyleID="s24"><Data ss:Type="String">(999) 999-9999</Data></Cell>
                    <Cell ss:StyleID="s22"/>
                   </Row>
                

                推薦答案

                同一用戶提出了兩個(gè)非常相似的問(wèn)題.OP 決定刪除一個(gè)并在此處合并,并要求我將我的答案從那里復(fù)制到此線程.

                There were two very similar question by the same user. The OP decided to delete one and combine this here and asked me to copy my answer from there to this thread.

                注意必須聲明為DEFAULT"的 xmlns-namespace:

                Be aware of the xmlns-namespace which must be declared as "DEFAULT":

                簡(jiǎn)化了您的 XML,但這個(gè)想法應(yīng)該沒(méi)問(wèn)題...

                Simplified your XML, but the idea should be OK...

                DECLARE @allUsers XML=
                '<?xml version="1.0"?>
                <?mso-application progid="Excel.Sheet"?>
                <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
                 xmlns:o="urn:schemas-microsoft-com:office:office"
                 xmlns:x="urn:schemas-microsoft-com:office:excel"
                 xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
                 xmlns:html="http://www.w3.org/TR/REC-html40">
                 <Worksheet>
                 <Table>
                   <Row ss:AutoFitHeight="0" ss:Height="30">
                    <Cell ss:StyleID="s22"/>
                    <Cell ss:StyleID="s24"><Data ss:Type="String">Jane Doe</Data></Cell>
                    <Cell ss:StyleID="s24"><Data ss:Type="String">JaneDoe</Data></Cell>
                    <Cell ss:StyleID="s24"><Data ss:Type="String">XYZ</Data></Cell>
                    <Cell ss:StyleID="s24"><Data ss:Type="String">(555) 555-5555</Data></Cell>
                    <Cell ss:StyleID="s22"/>
                   </Row>
                   </Table>
                 </Worksheet>   
                </Workbook>';
                
                ;WITH XMLNAMESPACES ('urn:schemas-microsoft-com:office:spreadsheet' as ss
                                     ,DEFAULT 'urn:schemas-microsoft-com:office:spreadsheet')
                SELECT T.X.value('Cell[1]/Data[1]','varchar(max)') AS DontKnow1
                      ,T.X.value('Cell[2]/Data[1]','varchar(max)') AS Name
                      ,T.X.value('Cell[3]/Data[1]','varchar(max)') AS UserName
                      ,T.X.value('Cell[4]/Data[1]','varchar(max)') AS DontKnow2
                      ,T.X.value('Cell[5]/Data[1]','varchar(max)') AS Telephone
                      ,T.X.value('Cell[6]/Data[1]','varchar(max)') AS DontKnow3
                FROM @allUsers.nodes('/Workbook/Worksheet/Table/Row') as T(X)
                

                這篇關(guān)于將具有相同標(biāo)記的 XML 值分成不同的行 SQL Server的文章就介紹到這了,希望我們推薦的答案對(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屋-程序員軟件開發(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?)
              • <legend id='lOt7b'><style id='lOt7b'><dir id='lOt7b'><q id='lOt7b'></q></dir></style></legend>

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

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

                  • <tfoot id='lOt7b'></tfoot>

                        • <bdo id='lOt7b'></bdo><ul id='lOt7b'></ul>
                            <tbody id='lOt7b'></tbody>
                          主站蜘蛛池模板: 免费毛片www com cn | 亚洲欧美一区二区三区视频 | 久草福利 | 天天曰夜夜操 | 91婷婷韩国欧美一区二区 | 日韩中文一区二区三区 | 亚洲欧美日韩电影 | 国产精品精品视频一区二区三区 | 久久久久久久久久毛片 | 欧美午夜精品 | 日韩一区二区黄色片 | 日韩中文字幕在线观看 | 97精品视频在线 | www.亚洲.com | 激情国产视频 | 亚洲国产成人精品女人 | 91佛爷在线观看 | 91看片在线观看 | 亚洲精品久久 | 91夜夜夜| 久久一区二区三区四区 | 一级高清 | 久久久久成人精品免费播放动漫 | 精品欧美一区二区三区久久久 | 国产日韩欧美一区二区 | 国产在线精品免费 | 成人在线视频免费观看 | 亚洲一区不卡 | 国产免费xxx | 91在线视频播放 | 亚洲欧洲视频 | 亚洲va国产日韩欧美精品色婷婷 | 一区二区福利视频 | 亚欧性视频 | 日韩一区二区视频 | 国产一区二区在线视频 | 一级日韩 | 日日操日日干 | 国产成人精品一区二区三区 | 久久51 | 亚洲欧美在线视频 |