久久久久久久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>
                            主站蜘蛛池模板: 天天拍天天色 | 亚洲精品成人网 | 久久亚洲国产精品日日av夜夜 | jav成人av免费播放 | 午夜影晥 | 天堂网色 | 精品国产一区二区在线 | 欧美日韩一区二区在线观看 | 亚洲国产成人精品女人久久久 | 久久91av| 国产一区二区三区视频免费观看 | 韩日精品一区 | 韩国精品一区 | 天久久 | 久久久久99| 国产一区二区视频在线观看 | 性国产丰满麻豆videosex | 久久久噜噜噜久久中文字幕色伊伊 | 一区二区三区日韩 | 黄色毛片在线播放 | 青青久久| 精品国产乱码久久久久久a丨 | 自拍偷拍亚洲视频 | 欧美国产视频 | 亚洲一区二区三区在线播放 | 天天操天天干天天爽 | 国产精品毛片在线 | 天堂网中文字幕在线观看 | 亚洲成人在线网 | 亚洲一区视频 | 国产精品久久久久久久久久 | 久久成人精品视频 | 97超碰成人 | 国产精品久久久久一区二区三区 | 欧美成人自拍视频 | 亚洲福利av | 欧美日韩国产一区二区 | 欧美日韩综合视频 | 免费精品 | 国产精品亚洲成在人线 | 综合久久综合久久 |