shanj
asked on
sql 2008
hello out their!
i need a sql agent-job to run the following script, this script runs excellent as a batch job,
for /f "delims=" %%x in ('dir /od /a-d /b \\tvwlitesp01\Litespeed\\O BI\*.bak') do set recent=%%x
del /q C:\Databasebackup\*.bak
Copy \\tvwlitesp01\Litespeed\\O BI\%recent % C:\Databasebackup\OBIbacku p.bak
thanks
i need a sql agent-job to run the following script, this script runs excellent as a batch job,
for /f "delims=" %%x in ('dir /od /a-d /b \\tvwlitesp01\Litespeed\\O
del /q C:\Databasebackup\*.bak
Copy \\tvwlitesp01\Litespeed\\O
thanks
ASKER
Hello Icohan!
i ran the job in Management studio and i get the following
output
%%x was unexpected at this time.
NULL
__________________________ ___
i ran the job in Management studio and i get the following
output
%%x was unexpected at this time.
NULL
__________________________
ASKER
Hello Rocky!
i followed your link + the following as advised
EXEC sp_configure 'show advanced options', 1
GO
RECONFIGURE
GO
EXEC sp_configure 'xp_cmdshell', 1
RECONFIGURE
GO
---------------
i excute the job as follows the file exists on the c drive and has the following name copy_db.bat
EXEC master..xp_CMDShell 'c:copy_db.bat'
result is
output
'c:copy_db.bat' is not recognized as an internal or external command,
operable program or batch file.
NULL
i followed your link + the following as advised
EXEC sp_configure 'show advanced options', 1
GO
RECONFIGURE
GO
EXEC sp_configure 'xp_cmdshell', 1
RECONFIGURE
GO
---------------
i excute the job as follows the file exists on the c drive and has the following name copy_db.bat
EXEC master..xp_CMDShell 'c:copy_db.bat'
result is
output
'c:copy_db.bat' is not recognized as an internal or external command,
operable program or batch file.
NULL
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Did not solve it
exec xp_cmdshell 'for /f "delims=" %%x in (''dir /od /a-d /b \\tvwlitesp01\Litespeed\\O
del /q C:\Databasebackup\*.bak
Copy \\tvwlitesp01\Litespeed\\O