SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Execute Process Task: Failed to lock Variable


Execute Process Task: Failed to lock Variable

Author
Message
Paul Dietz
Paul Dietz
Grasshopper
Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)

Group: General Forum Members
Points: 14 Visits: 11
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 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.
Paul Dietz
Paul Dietz
Grasshopper
Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)

Group: General Forum Members
Points: 14 Visits: 11
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 BigGrin
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search