The process exit code was "4" while the expected was "0". End Error DTExec:

  • I have a batch file that copies the contents of one folder and subfolders on a server, to another folder on another server.

    The Batch file contains

    xcopy P:\ /s /i /d E:\ /Y

    It runs fine when I manually run it or schedule it.

    I went into Visual Studion, Went to a new Project, dragged Execute Process Task, put in the path and name on the local machine to the batch file, saved it as a package on the local SQL Server. In Visual Studio, when I execute it, it runs fine.

    I went into Management Studio, made new job to this package. When I run it, it fails. History is.

    Error: 2010-02-24 08:52:06.23 Code: 0xC0029151 Source: Execute Process Task Execute Process Task Description: In Executing "C:\Shared\Copy Files.bat" "" at "", The process exit code was "4" while the expected was "0". End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 8:52:05 AM Finished: 8:52:06 AM Elapsed: 0.61 seconds. The package execution failed. The step failed.

    I have set security on the other server and the one the batch file is on for everyone to have full control, as a test. No help. I ran the SQL Service as the Network Admin and no good running the package.

    I use SQL 2005 sparingly, but was wondering if anyone could help me?

  • This is likely an issue with the return value of xcopy - the default success return value is 0 but it appears that xcopy is returning a nonzero value.

    To resolve this, you'll need to consult the xcopy documentation or the inline help. If a 4 is the expected success result, you can specify this in the configuration of the Execute Process Task.

    hth,

    Tim

    Tim Mitchell, Microsoft Data Platform MVP
    Data Warehouse and ETL Consultant
    TimMitchell.net | @Tim_Mitchell | Tyleris.com
    ETL Best Practices

  • Thank You Tim. I was able to figure out why it was not running. The batch ran fine when I scheduled it to run in task scheduler. That was then I realized, the Job was using mapped drives and I had to change the drives to a UNC path as well as editing the project to change parameters. Then it ran successfully 3 out of the last four days. The days it didn't run, it returned the same error, but that was because the batch could not connect to the share.

    Thank You,

    Ken

  • Excellent, glad it worked out for you. Thanks for the follow-up.

    Tim Mitchell, Microsoft Data Platform MVP
    Data Warehouse and ETL Consultant
    TimMitchell.net | @Tim_Mitchell | Tyleris.com
    ETL Best Practices

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply