February 2, 2017 at 3:14 pm
I'm scheduling a batch job in sql 2008 r2. This job will copy files between 2 folders using robocopy.
The job runs ok, but generates a low level error that causes the SQl Agent job to fail. The files are transferred successfully. I've tried capturing the error using errorlevel without success. Is there a way to prevent these low level errors from causing the sql agent job to fail?
When the snows fall and the white winds blow,The lone wolf dies but the pack survives.
Once you've accepted your flaws, no one can use them against you.
February 2, 2017 at 3:21 pm
Try creating a PowerShell script to run it and handle errors in the ps script.
February 2, 2017 at 4:30 pm
I'm a powershell rookie. Here is my 1st attempt.
copy-item -Path \\servera\D$\sqlbackups\*.bak -destination \\serverb\D$\sqlbackups\
When I run this in SQL Server agent, I get a successful result. Only problem is no files are copied to serverb.
I checked the UNC paths and both are valid. I bet it is something very obvious...
When the snows fall and the white winds blow,The lone wolf dies but the pack survives.
Once you've accepted your flaws, no one can use them against you.
February 2, 2017 at 4:50 pm
And this has a lot of things posted about options with batch files:
Getting ROBOCOPY to return a “proper” exit code?
Sue
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply