久久久久久久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. 將具有相同標記的 XML 值分成不同的行 SQL Server

      Separating XML values with the same tags into different rows SQL Server(將具有相同標記的 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'>

                本文介紹了將具有相同標記的 XML 值分成不同的行 SQL Server的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                限時送ChatGPT賬號..

                我有一個要解析的 XML 文件.XML 是使用

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

                另存為 XML

                因為 XML 文件是從 Microsoft Excel 創建的,所以它有這個標題:

                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">
                

                我試圖提取的數據是這樣設置的:

                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>
                

                現在,我的查詢如下所示:

                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'
                

                并給我這些結果:

                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.

                有沒有辦法做到這一點?

                Is there any way to do this?

                XML 文件的一般結構如下:

                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

                編輯

                從我表述這個問題的方式來看,標題名稱似乎已經被編入,但它們實際上被讀取為 <;/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>
                

                推薦答案

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

                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":

                簡化了您的 XML,但這個想法應該沒問題...

                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)
                

                這篇關于將具有相同標記的 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?)
              • <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>
                          主站蜘蛛池模板: 一区二区三区精品在线视频 | 欧美精品一区二区三区在线播放 | 亚洲一区二区三区国产 | 午夜视频在线免费观看 | 日韩在线欧美 | 精国产品一区二区三区 | 亚洲国产一区二区三区 | 日韩欧美1区2区 | 亚洲精品在线国产 | 精品国产乱码久久久久久蜜臀 | 成人免费观看男女羞羞视频 | 啪啪免费网站 | 亚洲国产精品久久久久婷婷老年 | 免费观看一级特黄欧美大片 | 综合久久亚洲 | 亚洲欧美日韩精品久久亚洲区 | 91视频在线 | 欧美一级片黄色 | 久久久久国产一区二区三区 | 成人国产精品久久 | 九九一级片 | 九九久久久| 国产区精品在线观看 | 久久在线看 | 综合九九| www.黄色网| 超碰人人91| 日韩一级一区 | 成人久久18免费网站 | 亚洲福利av| 中文字幕一区二区三区精彩视频 | 欧美午夜精品理论片a级按摩 | 男人影音 | 亚洲精视频| 亚洲成人三级 | 国产精品美女久久久久aⅴ国产馆 | 人人射人人| 成人区精品一区二区婷婷 | 亚洲午夜精品在线观看 | 精品99在线 | 高清视频一区二区三区 |