久久久久久久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 查詢結(jié)果保存到文件

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

          <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 查詢結(jié)果保存到文件的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

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

                  我有一個(gè) SQL 查詢,我使用 For XML Path 將結(jié)果生成為 XML.

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

                  誰(shuí)能幫助我將 XML 輸出轉(zhuǎn)換為a.xml"文件并保存在計(jì)算機(jī)的特定文件夾中?

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

                  也想知道,除了BCP還有什么方法可以實(shí)現(xiàn)嗎?

                  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 命令,例如設(shè)置編碼...

                  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 + '\""'
                  

                  一些注意事項(xiàng)...

                  該命令有 8000 個(gè)字符的長(zhǎng)度限制,因此不適用于大文件.

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

                  如果您將文件保存到映射驅(qū)動(dòng)器,它將在數(shù)據(jù)庫(kù)服務(wù)器上查找該驅(qū)動(dòng)器.因此,C:\ 將指服務(wù)器的 C:\ 驅(qū)動(dòng)器,而不是您運(yùn)行 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.

                  運(yùn)行xp_cmdshell需要特殊權(quán)限.

                  點(diǎn)擊此處了解更多詳情.

                  Click here for more details.

                  這篇關(guān)于如何將 XML 查詢結(jié)果保存到文件的文章就介紹到這了,希望我們推薦的答案對(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)文檔推薦

                  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屋-程序員軟件開(kāi)發(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?)
                  WinForms application design - moving documents from SQL Server to file storage(WinForms 應(yīng)用程序設(shè)計(jì)——將文檔從 SQL Server 移動(dòng)到文件存儲(chǔ))
                  <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>
                            主站蜘蛛池模板: 老司机免费视频 | 色www精品视频在线观看 | 激情免费视频 | 蜜桃视频一区二区三区 | 久久久久久国产精品mv | 黄色av网站在线免费观看 | av免费成人 | 久久黄色网 | 国产一区二区 | 久久久久久女 | 日韩中文字幕在线视频 | 91精品国产综合久久久久久首页 | 亚洲人成在线观看 | 中文字幕免费在线 | 欧美日韩视频在线播放 | 国产www成人 | 国产在线第一页 | av看看| 日本视频在线播放 | 在线天堂免费中文字幕视频 | 欧美一区二区三区在线观看视频 | 国产精品一区二区三级 | 天天操妹子 | 成人h动漫亚洲一区二区 | 国产一区二区三区四区三区四 | 欧美日一区二区 | 日韩成人精品视频 | 精品一区二区三区在线播放 | 特黄级国产片 | 在线视频一区二区 | 久久久av一区| 久久久精 | 欧美一区二区三区在线观看视频 | 日本羞羞影院 | 久久精品国产一区二区电影 | 精品久久久久久久久久久久久 | 精品日韩在线 | 九九热精品视频 | 精品一区av | 天天澡天天狠天天天做 | 青青久久 |