Hi, this is a code when I execute it from sql server query window , it runs. Does anyone knows how I can reverse the function so instead of zipping the files I need to unzip them into a new folder.....
thanks for your help and support
Al
declare @varcmd varchar(255), @CurrentDate char(50),@OldDate char(50),
@txtfilename varchar(30),
@CurrentZipFilename varchar(50),
@CurrentZipFilename_old varchar(50)
Select @CurrentDate = convert(char(50),getdate(),112)
Select @OldDate = convert(char(50),getdate()-1,112)
select @CurrentZipFilename = 'xyz' +'_'+ substring(@CurrentDate,1,8)+'.zip'
select @CurrentZipFilename_old = 'xyz' +'_'+ substring(@OldDate,1,8)+'.zip'
select @CurrentZipFilename as Current_zipedfile,@CurrentZipFilename_old as Old_zipedFile ,@CurrentDate as CurrentDate,@OldDate as OldDate
-- extract data from table to out folder by executing the following sp
--execute p_BCP_out_cursor
select @varcmd =null
select @varcmd = 'C:\Batch_code\zip -j C:\OUT\'+@CurrentZipFilename+' C:\OUT\*.*'
exec master..xp_cmdshell @varcmd
Print '***************move the zip file to C:\OUT_TRANSIT\ *********'
select @varcmd = null
/*this is the text file need to be zipped,copy and past into diff dir no date addedto file name */
select @varcmd = 'move C:\OUT\'+@CurrentZipFilename+' C:\OUT_TRANSIT\'
exec master..xp_cmdshell @varcmd
thanks for your help and support
Al
declare @varcmd varchar(255), @CurrentDate char(50),@OldDate char(50),
@txtfilename varchar(30),
@CurrentZipFilename varchar(50),
@CurrentZipFilename_old varchar(50)
Select @CurrentDate = convert(char(50),getdate(),112)
Select @OldDate = convert(char(50),getdate()-1,112)
select @CurrentZipFilename = 'xyz' +'_'+ substring(@CurrentDate,1,8)+'.zip'
select @CurrentZipFilename_old = 'xyz' +'_'+ substring(@OldDate,1,8)+'.zip'
select @CurrentZipFilename as Current_zipedfile,@CurrentZipFilename_old as Old_zipedFile ,@CurrentDate as CurrentDate,@OldDate as OldDate
-- extract data from table to out folder by executing the following sp
--execute p_BCP_out_cursor
select @varcmd =null
select @varcmd = 'C:\Batch_code\zip -j C:\OUT\'+@CurrentZipFilename+' C:\OUT\*.*'
exec master..xp_cmdshell @varcmd
Print '***************move the zip file to C:\OUT_TRANSIT\ *********'
select @varcmd = null
/*this is the text file need to be zipped,copy and past into diff dir no date addedto file name */
select @varcmd = 'move C:\OUT\'+@CurrentZipFilename+' C:\OUT_TRANSIT\'
exec master..xp_cmdshell @varcmd