Execute Process Task: Failed to lock Variable

  • I'm having trouble setting up the StandardOutputVariable for a Execute Process Task in SSIS. I wanted to execute a batch file SSIS with 2 parameters. I'm using the parameters to determine if the batch job completed successfully or not and capture the error message. I did the following:

    1) Dragged the Execute Process Task

    2) Set the executable property to: c:\user\Paul\documents\test.bat

    3) Set the StandandardOutputVariable to: User::ErrorCode

    4) Set the SuccessValue to: 0

    Here is the test.bat code:

    @Echo OFF

    Echo ================== >> mybat_log.txt

    Echo Start: %Date% %Time%

    Echo.

    Echo Start: %Date% %Time% >> mybat_log.txt

    rem ==================================

    rem 2>&1 sends the actual error message

    rem http://technet.microsoft.com/en-us/library/bb490982.aspx

    rem ===================================

    C:\WINDOWS\system32\ping.exe http://www.google.com >> mybat_log.txt 2>&1

    Echo ErrorLevel = %ERRORLEVEL% >> mybat_log.txt

    IF %ERRORLEVEL% NEQ 0 (ECHO An error has occurred on the mybat.bat file.

    Echo Please check the log file for more detail at D:\mybat_log.txt

    ) ELSE (ECHO The mybat.bat file ran successfully)

    Echo.

    Echo End: %Date% %Time%

    Echo End: %Date% %Time% >> mybat_log.txt

    Echo.

    Echo —

    Echo Sent from SQL Server SSIS Package

    EXIT %ERRORLEVEL%

    When I execute the package I receive the follow error:

    SSIS package "Package.dtsx" starting.

    Error: 0xC0014055 at Execute Process Task: Failed to lock variable "User::ErrorCode" for read/write access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.".

    Error: 0xC002F304 at Execute Process Task, Execute Process Task: An error occurred with the following error message: "Failed to lock variable "User::ErrorCode" for read/write access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.".

    ".

    Task failed: Execute Process Task

    Warning: 0x80019002 at Package: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (3) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.

    SSIS package "Package.dtsx" finished: Failure.

    The program '[2556] Package.dtsx: DTS' has exited with code 0 (0x0).

    Thanks in advance.

  • Okay, I was able to figure out how to add a variable to the package (Right click in the package area and select add variable). The last thing I had to do to get it to work was change the variable property to type to object. Everything seems to be working fine 😀

Viewing 2 posts - 1 through 1 (of 1 total)

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