Home Forums SQL Server 2005 Backups Using Robocopy within SQL Agent job - headache with error codes! RE: Using Robocopy within SQL Agent job - headache with error codes!

  • I put the following into a bat file and then execute that from my SQL Server Agent job...

    rem RoboCopyErrors.bat

    robocopy %*

    rem suppress successful robocopy exit statuses, only report genuine errors (bitmask 16 and 8 settings)

    set/A errlev="%ERRORLEVEL% & 24"

    rem exit batch file with errorlevel so SQL job can succeed or fail appropriately

    exit/B %errlev%

    I found this here: http://weblogs.sqlteam.com/robv/archive/2010/02/17/61106.aspx