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

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

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

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

      • <bdo id='bUpm4'></bdo><ul id='bUpm4'></ul>

    1. <tfoot id='bUpm4'></tfoot>
    2. 如何將數據從 xml 保存到 sql 2008?

      How can I save data from xml to sql 2008?(如何將數據從 xml 保存到 sql 2008?)

        <small id='0ofdK'></small><noframes id='0ofdK'>

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

                本文介紹了如何將數據從 xml 保存到 sql 2008?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                限時送ChatGPT賬號..

                如何將數據從 xml 保存到 sql 2008?

                How can I save data from xml to sql 2008?

                SQL 表:

                 [dbo].[Position](
                    [ID] [int] IDENTITY(1,1) NOT NULL,
                    [ImoNo] [numeric](8, 0) NOT NULL,
                    [sid] [numeric](5, 0) NULL,
                    [VesselName] [nvarchar](20) NULL,
                    [time] [datetime] NOT NULL,
                    [lat] [numeric](9, 2) NULL,
                    [lon] [numeric](9, 2) NULL,
                    [sog] [numeric](9, 2) NULL,
                    [cog] [numeric](9, 2) NULL,
                      [hdg] [numeric](9, 2) NULL,
                    [eta] [datetime] NULL,
                    [NextPort] [nvarchar](20) NULL)
                

                XML 文件:

                <?xml version="1.0" encoding="UTF-8"?>
                <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"     xmlns:ns1="http://www.fleettracker.de/api/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <SOAP-ENV:Body>
                <ns1:GetPositionsResponse>
                  <body>
                    <result>Found 2 vessels.</result>
                    <success>true</success>
                    <shipsWithPositions xsi:type="ns1:FleettrackerShip">
                      <ns1:imono>9456159</ns1:imono>
                      <ns1:sid>780</ns1:sid>
                      <ns1:name>Trenta</ns1:name>
                      <ns1:charterShipName>Trenta</ns1:charterShipName>
                      <ns1:pasttrack>
                        <lat>1832900</lat>
                        <lon>7570400</lon>
                        <timestamp>2014-01-14T08:28:45Z</timestamp>
                        <orderNumber>0</orderNumber>
                        <sog>9.5</sog>
                        <cog>22</cog>
                        <hdg>22</hdg>
                        <eta>2014-01-15T12:00:00</eta>
                        <nextport>KWANGYANG</nextport>
                      </ns1:pasttrack>
                      <ns1:pasttrack>
                        <lat>1872560</lat>
                        <lon>7589000</lon>
                        <timestamp>2014-01-14T07:00:00Z</timestamp>
                        <orderNumber>1</orderNumber>
                        <sog>10.8</sog>
                        <cog>25</cog>
                        <hdg>25</hdg>
                      </ns1:pasttrack>
                    </shipsWithPositions>
                 <shipsWithPositions xsi:type="ns1:FleettrackerShip">
                      <ns1:imono>9144055</ns1:imono>
                      <ns1:sid>789</ns1:sid>
                      <ns1:name>Vipava</ns1:name>
                      <ns1:charterShipName>Vipava</ns1:charterShipName>
                      <ns1:pasttrack>
                        <lat>1757160</lat>
                        <lon>7536240</lon>
                        <timestamp>2014-01-13T19:00:00Z</timestamp>
                        <orderNumber>2</orderNumber>
                        <sog>9.4</sog>
                        <cog>21</cog>
                        <hdg>21</hdg>
                      </ns1:pasttrack>
                      <ns1:pasttrack>
                        <lat>1658200</lat>
                        <lon>7476480</lon>
                        <timestamp>2014-01-13T07:00:00Z</timestamp>
                        <orderNumber>3</orderNumber>
                        <sog>8.4</sog>
                        <cog>29</cog>
                        <hdg>29</hdg>
                      </ns1:pasttrack>
                      <ns1:pasttrack>
                        <lat>1630000</lat>
                        <lon>7455400</lon>
                        <timestamp>2014-01-13T03:00:03Z</timestamp>
                        <orderNumber>4</orderNumber>
                        <sog>8.83</sog>
                        <cog>34</cog>
                        <hdg>34</hdg>
                        <eta>2014-01-15T08:00:00</eta>
                        <nextport>KWANGYANG</nextport>
                      </ns1:pasttrack>
                    </shipsWithPositions>
                  </body>
                </ns1:GetPositionsResponse>
                </SOAP-ENV:Body>
                </SOAP-ENV:Envelope>
                

                我嘗試使用此查詢,但收到錯誤消息

                I tried with this query, but I get error msg

                'XQuery [nodes()]: The names "SOAP-ENV" and "ns1:" do not denote a namespace.'
                

                DECLARE @xml XML
                DECLARE @character VARCHAR(MAX)
                
                SELECT @character = x.y
                FROM OPENROWSET( BULK 'C:\Users\Nale\Desktop\POS.xml', SINGLE_CLOB ) x(y)
                
                -- Fix up the ampersand
                SELECT @xml = REPLACE( @character, '&', '&amp;' )
                
                
                -- Get the tally information
                SELECT 
                x.y.value('ns1:imono/text())[1]', 'NUMERIC (8,0)') ImoNo,
                x.y.value('ns1:sid/text())[1]', 'NUMERIC (5,0)') sid,
                x.y.value('ns1:VesselName/text())[1]', 'NVARCHAR (20)') VesselName,
                x.y.value('ns1:pasttrack/time/text())[1]', 'DATETIME') time,
                x.y.value('ns1:pasttrack/lat/text())[1]', 'NUMERIC (9,2)') lat,
                x.y.value('ns1:pasttrack/lon/text())[1]', 'NUMERIC (9,2)') lon,
                x.y.value('ns1:pasttrack/sog/text())[1]', 'NUMERIC (9,2)') sog,
                x.y.value('ns1:pasttrack/cog/text())[1]', 'NUMERIC (9,2)') cog,
                x.y.value('ns1:pasttrack/hdg/text())[1]', 'NUMERIC (9,2)') hdg,
                x.y.value('ns1:pasttrack/eta/text())[1]', 'DATETIME') eta,
                x.y.value('ns1:pasttrack/NextPort/text())[1]', 'NVARCHAR (20)') NextPort
                FROM @xml.nodes('SOAP-ENV:Envelope/SOAP-ENV:Body/ns1:GetPositionsResponse/body/shipsWithPositions') AS x(y)
                

                XML 文件在本地磁盤上.

                XML file is on local disk.

                我會使用一些 sql 查詢,或者將數據從 xml 保存到 sql 表的最佳方法是什么?

                Will I use some sql query, or what is the best way to save data from xml to sql table?

                推薦答案

                1. 使 XML 有效

                <?xml version="1.0" encoding="UTF-8"?>
                <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"     xmlns:ns1="http://www.fleettracker.de/api/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                    <SOAP-ENV:Body>
                        <ns1:GetPositionsResponse>
                            <body>
                                <result>Found 2 vessels.</result>
                                <success>true</success>
                                <shipsWithPositions xsi:type="ns1:FleettrackerShip">
                                    <ns1:imono>9456159</ns1:imono>
                                    <ns1:sid>780</ns1:sid>
                                    <ns1:name>Trenta</ns1:name>
                                    <ns1:charterShipName>Trenta</ns1:charterShipName>
                                    <ns1:pasttrack>
                                        <lat>1832900</lat>
                                        <lon>7570400</lon>
                                        <timestamp>2014-01-14T08:28:45Z</timestamp>
                                        <orderNumber>0</orderNumber>
                                        <sog>9.5</sog>
                                        <cog>22</cog>
                                        <hdg>22</hdg>
                                        <eta>2014-01-15T12:00:00</eta>
                                        <nextport>KWANGYANG</nextport>
                                    </ns1:pasttrack>
                                    <ns1:pasttrack>
                                        <lat>1872560</lat>
                                        <lon>7589000</lon>
                                        <timestamp>2014-01-14T07:00:00Z</timestamp>
                                        <orderNumber>1</orderNumber>
                                        <sog>10.8</sog>
                                        <cog>25</cog>
                                        <hdg>25</hdg>
                                    </ns1:pasttrack>
                                </shipsWithPositions>
                                <shipsWithPositions xsi:type="ns1:FleettrackerShip">
                                    <ns1:imono>9144055</ns1:imono>
                                    <ns1:sid>789</ns1:sid>
                                    <ns1:name>Vipava</ns1:name>
                                    <ns1:charterShipName>Vipava</ns1:charterShipName>
                                    <ns1:pasttrack>
                                        <lat>1757160</lat>
                                        <lon>7536240</lon>
                                        <timestamp>2014-01-13T19:00:00Z</timestamp>
                                        <orderNumber>2</orderNumber>
                                        <sog>9.4</sog>
                                        <cog>21</cog>
                                        <hdg>21</hdg>
                                    </ns1:pasttrack>
                                    <ns1:pasttrack>
                                        <lat>1658200</lat>
                                        <lon>7476480</lon>
                                        <timestamp>2014-01-13T07:00:00Z</timestamp>
                                        <orderNumber>3</orderNumber>
                                        <sog>8.4</sog>
                                        <cog>29</cog>
                                        <hdg>29</hdg>
                                    </ns1:pasttrack>
                                    <ns1:pasttrack>
                                        <lat>1630000</lat>
                                        <lon>7455400</lon>
                                        <timestamp>2014-01-13T03:00:03Z</timestamp>
                                        <orderNumber>4</orderNumber>
                                        <sog>8.83</sog>
                                        <cog>34</cog>
                                        <hdg>34</hdg>
                                        <eta>2014-01-15T08:00:00</eta>
                                        <nextport>KWANGYANG</nextport>
                                    </ns1:pasttrack>
                                </shipsWithPositions>
                            </body>
                        </ns1:GetPositionsResponse>
                    </SOAP-ENV:Body>
                </SOAP-ENV:Envelope>
                

                2.為您的查詢添加命名空間

                2. Add namespaces to your query

                DECLARE @xml XML
                DECLARE @character VARCHAR(MAX)
                
                SELECT @xml = x.y
                FROM OPENROWSET( BULK 'C:\Users\Nale\Desktop\POS.xml', SINGLE_CLOB ) x(y)
                
                
                -- Get the tally information
                ;WITH XMLNAMESPACES  (
                    'http://www.fleettracker.de/api/1.0' as ns1,
                    'http://www.w3.org/2001/XMLSchema-instance' AS xsi,
                    'http://schemas.xmlsoap.org/soap/envelope/' AS e
                )
                SELECT
                    x.y.value('(ns1:imono/text())[1]', 'NUMERIC (8,0)') ImoNo,
                    x.y.value('(ns1:sid/text())[1]', 'NUMERIC (5,0)') sid,
                    x.y.value('(ns1:VesselName/text())[1]', 'NVARCHAR (20)') VesselName,
                    x.y.value('(ns1:pasttrack/time/text())[1]', 'DATETIME') time,
                    x.y.value('(ns1:pasttrack/lat/text())[1]', 'NUMERIC (9,2)') lat,
                    x.y.value('(ns1:pasttrack/lon/text())[1]', 'NUMERIC (9,2)') lon,
                    x.y.value('(ns1:pasttrack/sog/text())[1]', 'NUMERIC (9,2)') sog,
                    x.y.value('(ns1:pasttrack/cog/text())[1]', 'NUMERIC (9,2)') cog,
                    x.y.value('(ns1:pasttrack/hdg/text())[1]', 'NUMERIC (9,2)') hdg,
                    x.y.value('(ns1:pasttrack/eta/text())[1]', 'DATETIME') eta,
                    x.y.value('(ns1:pasttrack/NextPort/text())[1]', 'NVARCHAR (20)') NextPort
                FROM @xml.nodes('e:Envelope/e:Body/ns1:GetPositionsResponse/body/shipsWithPositions') AS x(y)
                

                這篇關于如何將數據從 xml 保存到 sql 2008?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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?)

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

                  <legend id='gvN4R'><style id='gvN4R'><dir id='gvN4R'><q id='gvN4R'></q></dir></style></legend>
                    <bdo id='gvN4R'></bdo><ul id='gvN4R'></ul>
                    • <tfoot id='gvN4R'></tfoot>

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

                        1. 主站蜘蛛池模板: 91精品国产乱码久久久久久久久 | 青青草视频网站 | 高清不卡毛片 | 国产精品久久免费观看 | 中文字幕在线观看 | 黄色片免费在线观看 | 巨大荫蒂视频欧美另类大 | 久久综合一区二区三区 | 国产婷婷色一区二区三区 | 日韩毛片免费视频 | 久久天天躁狠狠躁夜夜躁2014 | 成人h视频 | 神马久久久久久久久久 | 永久www成人看片 | 成人日韩精品 | 国产欧美在线观看 | 欧美成年网站 | 91精品国产91久久久久久丝袜 | 欧美久久久久 | 日本久久精品视频 | 久久久精彩视频 | 天天夜夜操 | av中文在线| 日本爱爱| 青青草综合网 | 精品免费| 免费成人在线网站 | 久久精品国产v日韩v亚洲 | 伊人网国产 | 国产精品一区二区久久 | 亚洲视频欧美视频 | 操操网站| 久久亚洲一区 | 在线精品一区二区 | 国产一区二区三区久久久久久久久 | 久久精品亚洲精品 | 99色在线视频 | 亚洲免费在线 | 国产精品久久久久久久久免费樱桃 | av影音| 91高清视频在线 |