如何在SQL SERVER 2008中从存储过程创建Zip文件
问题描述:
如何从SQL SERVER 2008中的存储过程创建Zip文件?
假设我在D中有文件:\测试
我想要压缩该文件夹任何其他位置,如c:\ Test.zip
请让我知道是否可能,如果是,那么如何?
How to Create Zip file from Stored Procedure in SQL SERVER 2008?
Suppose i have file in D:\Test
And i want to Zip that folder in any other location like c:\Test.zip
Please let me know is it possible or not if yes then how?
答
您可以使用SQL Stored proc创建zip文件。你需要调用shell并调用相应的程序或API来压缩文件。
我不确定你的确切要求是什么,但从SQL Proc调用shell并调用另一个程序不是好的做法。
如果您仍想使用存储过程压缩文件,请通过以下链接:
http: //blog.akumars.esoftera.in/post/2012/05/17/Create-zip-file-in-stored-procedure-in-Sql-server.aspx [ ^ ]
http://blog.akumars.esoftera.in/post/2012/05/17/Create-zip-or-rar-file -in-stored-procedure-in-Sql-server.aspx [ ^ ]
You can create the zip file using SQL Stored proc. You need to invoke the shell and call the corresponding program or API to zip the file.
I am not sure what is your exact requirement, but invoking a shell from SQL Proc and calling another program is not a good practice.
If you still want to zip the file using stored proc go through the below links:
http://blog.akumars.esoftera.in/post/2012/05/17/Create-zip-file-in-stored-procedure-in-Sql-server.aspx[^]
http://blog.akumars.esoftera.in/post/2012/05/17/Create-zip-or-rar-file-in-stored-procedure-in-Sql-server.aspx[^]