Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 zip backup file in sql command

Author  Topic 

amirs
Constraint Violating Yak Guru

260 Posts

Posted - 2012-04-12 : 05:10:39
Dear Member

I have zip backup file to use following command

DECLARE @SERVER VARCHAR(100), @COMMAND VARCHAR(100), @FILE VARCHAR(100),@PATH VARCHAR(30)
SET @SERVER = @@SERVERNAME

SET @COMMAND = '"C:\Program Files\WinRAR\RAR.exe" A "D:\SQLBACKUPS\FILE_BACKUP.BK"'

EXEC XP_CMDSHELL @COMMAND

but i got a following error
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

i think it is not read a program file path so how to execute this command

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-04-12 : 12:33:27
Add the path to the "path" environmental variable on the server and then you won't need to specify the path at all, just rar.exe. You'll need to restart the SQL service though as it puts the variables in memory.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -