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

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

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

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

      1. <legend id='yHHLi'><style id='yHHLi'><dir id='yHHLi'><q id='yHHLi'></q></dir></style></legend>
        <tfoot id='yHHLi'></tfoot>

        如何將 XML 查詢結果保存到文件

        How To Save XML Query Results to a File(如何將 XML 查詢結果保存到文件)

          <small id='63L9w'></small><noframes id='63L9w'>

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

              <tbody id='63L9w'></tbody>
          • <legend id='63L9w'><style id='63L9w'><dir id='63L9w'><q id='63L9w'></q></dir></style></legend>
                <tfoot id='63L9w'></tfoot>

                  本文介紹了如何將 XML 查詢結果保存到文件的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我有一個 SQL 查詢,我使用 For XML Path 將結果生成為 XML.

                  I have an SQL query and I am using For XML Path to generate the result as an XML.

                  誰能幫助我將 XML 輸出轉換為a.xml"文件并保存在計算機的特定文件夾中?

                  Can anyone help me about converting that XML output into "a.xml" file and save in a particular folder of a computer?

                  也想知道,除了BCP還有什么方法可以實現嗎?

                  Also want to know, is there any method other than BCP to achieve this?

                  推薦答案

                  您可以嘗試使用 xp_cmdshell....

                  You could try using xp_cmdshell....

                  -- Read your query results into an XML variable
                  DECLARE @xml AS XML = (SELECT * FROM YourTable FOR XML PATH)
                  
                  -- Cast the XML variable into a VARCHAR
                  DECLARE @xmlChar AS VARCHAR(max) = CAST(@xml AS VARCHAR(max))
                  
                  -- Escape the < and > characters
                  SET @xmlChar = REPLACE(REPLACE(@xmlChar, '>', '^>'), '<', '^<')
                  
                  -- Create command text to echo to file
                  DECLARE @command VARCHAR(8000) = 'echo ' + @xmlChar + ' > c:\test.txt'
                  
                  -- Execute the command
                  EXEC xp_cmdshell @command
                  

                  如果您想要更多控制,您也可以嘗試使用 Powershell 命令,例如設置編碼...

                  You could also try a Powershell command if you wanted a bit more control e.g. to set encoding...

                  DECLARE @command VARCHAR(8000) = 'powershell -Command "Set-Content -Encoding UTF8 C:\test.txt \"' + @xmlChar + '\""'
                  

                  一些注意事項...

                  該命令有 8000 個字符的長度限制,因此不適用于大文件.

                  There is an 8000 character length limit on the command, so it's no good for large files.

                  如果您將文件保存到映射驅動器,它將在數據庫服務器上查找該驅動器.因此,C:\ 將指服務器的 C:\ 驅動器,而不是您運行 Management Studio 的位置.

                  If you save the file to a mapped drive, it will look for that drive on the database server. So, C:\ will be referring to the C:\ drive of the server, not where you are running Management Studio.

                  運行xp_cmdshell需要特殊權限.

                  點擊此處了解更多詳情.

                  Click here for more details.

                  這篇關于如何將 XML 查詢結果保存到文件的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  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?)
                  WinForms application design - moving documents from SQL Server to file storage(WinForms 應用程序設計——將文檔從 SQL Server 移動到文件存儲)
                  <i id='CXGfA'><tr id='CXGfA'><dt id='CXGfA'><q id='CXGfA'><span id='CXGfA'><b id='CXGfA'><form id='CXGfA'><ins id='CXGfA'></ins><ul id='CXGfA'></ul><sub id='CXGfA'></sub></form><legend id='CXGfA'></legend><bdo id='CXGfA'><pre id='CXGfA'><center id='CXGfA'></center></pre></bdo></b><th id='CXGfA'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='CXGfA'><tfoot id='CXGfA'></tfoot><dl id='CXGfA'><fieldset id='CXGfA'></fieldset></dl></div>

                  <tfoot id='CXGfA'></tfoot>
                1. <small id='CXGfA'></small><noframes id='CXGfA'>

                        <tbody id='CXGfA'></tbody>
                          <bdo id='CXGfA'></bdo><ul id='CXGfA'></ul>
                            <legend id='CXGfA'><style id='CXGfA'><dir id='CXGfA'><q id='CXGfA'></q></dir></style></legend>
                            主站蜘蛛池模板: 精品99爱视频在线观看 | 日韩成人高清 | 国产精品黄视频 | 亚洲精美视频 | 精品久久精品 | 国产精品一区二区av | 在线欧美小视频 | 噜啊噜在线 | 亚洲天堂一区二区 | 亚洲精品68久久久一区 | 亚洲天堂av网 | 奇色影视| 午夜综合 | 免费久久精品视频 | 国产精品欧美一区二区三区不卡 | 亚洲福利在线观看 | 成人精品鲁一区一区二区 | 免费看黄色国产 | 国产精品综合一区二区 | 一区二区三区四区国产 | 五月婷婷丁香 | 狠狠视频 | 五月激情综合 | 91精品国产91久久综合桃花 | 国产98色在线 | 欧美一区二区三区久久精品 | av电影手机版 | 成人污污视频 | 中文字幕成人在线 | 中文字幕在线免费观看 | 久久久www成人免费精品 | 欧美一区二区在线观看 | 日韩精品在线观看免费 | 欧美美女被c | 久久一二三区 | 国产欧美日韩在线观看 | 久久久久久久久久久福利观看 | 欧美精品第三页 | 欧美激情国产精品 | 青青草精品视频 | 妖精视频一区二区三区 |