Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
|
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 13th, 2005, 06:55 AM
Registered User
 
Join Date: Nov 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Unzip in Stored Procedure

Morning to EveryOne -

I need to read a folder on another server and if a file is there, delete it. Then I need to unzip another file.

How can I do this from a stored procedure in T-SQL ?

Thanks in advance,
Stoney
 
Old April 13th, 2005, 08:46 AM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 303
Thanks: 0
Thanked 0 Times in 0 Posts
Default

For unzip file create a stored procedure (you can also run this procedure as SQL server scheduled job)..


CREATE PROCEDURE procUnzipFile
AS
BEGIN
DECLARE @Command nvarchar(1000)
SET @Command = 'C:\MyFolder\unzipfile.bat'
EXEC xp_cmdshell @Command
END
GO


Your batch file (unzipfile.bat)
----------------------------------
c:\program files\winzip\wzunzip c:\myfolder\file.zip c:\myfolder
-------------------------------------

same thing is for delete create a batch file and call this batch file using xp_cmdshell in SQL server
 
Old April 15th, 2005, 05:04 AM
Registered User
 
Join Date: Nov 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey!! Thanks!!
Stoney





Similar Threads
Thread Thread Starter Forum Replies Last Post
This Stored Procedure rao965 SQL Server 2000 2 July 2nd, 2007 07:21 PM
Stored Procedure muthu555 SQL Server 2000 1 March 5th, 2007 07:13 AM
please help me with this stored procedure bebeko SQL Server 2000 1 June 10th, 2005 12:09 PM
Stored Procedure bmains SQL Server ASP 2 October 8th, 2004 03:19 AM
C# and stored procedure Msmsn C# 1 August 26th, 2003 11:03 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.