本文介紹了SQL Server 代理作業 - 將結果導出到制表符分隔文件?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我設置了一個在特定時間運行存儲過程的 SQL 服務器代理作業.存儲過程運行完成后,如何將結果導出到制表符分隔文件?
I setup a SQL server agent job that runs a stored procedure at a specific time. Once the stored procedure is done running, how can I export the results to a Tab Delimited file?
我使用的是 SQL Server 2008 R2.
I'm using SQL Server 2008 R2.
謝謝
推薦答案
如果您啟用了 xp_cmdshell 并且您的帳戶具有訪問權限,您可以嘗試:
If you have xp_cmdshell enabled and if your account has access you could try:
EXEC xp_cmdshell 'bcp "SELECT * FROM tblName" queryout "C:\tblNameData.txt" -T -c
另一種方法是像@Neil 提到的那樣:SSIS.這是一個鏈接:
Another way is to do it as @Neil mentioned: SSIS. Here's a link:
http://decipherinfosys.wordpress.com/2008/07/23/ssis-exporting-data-to-a-text-file-using-a-package/
這篇關于SQL Server 代理作業 - 將結果導出到制表符分隔文件?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!