July 15, 2009 at 6:42 am
Is there any exit command that can be used to exit the SSIS package.
I am looking something simislar to Application.Exit()
For example
In a complex SSIS package one of the tasks is Script task. On certain condition I want to stop executing the total package. So Is there any statement I can give to exit the total package.
All these tasks are in a ForEach loop container.
I don't even want the foreach loop container to loop through. The FOREach loop has maximum error count 999.This is to allow the loop to continue if any exception happens inside any of the tasks. But for one of the condition I want to exit the total package.Please advise.
July 15, 2009 at 9:17 am
Try this: in the script code, throw an exception, handle it gracefully\mask it in the OnError.
There you have it.
July 15, 2009 at 10:41 am
Thanks for your reply. I can get to the OnError but How to terminate the execution of the package. The container of all these tasks is a ForEach loop.
July 15, 2009 at 10:48 am
If you raise the error it should fail the package (Assuming that you have set the following properties FAIL PARENT ON FAILURE = "TRUE" on all tasks in the for each loop AND FAIL PACKAGE ON FAILURE = "TRUE")
July 15, 2009 at 12:37 pm
The properties FailPackageOnFailure and FailPArentOnFailure are kept False for a reason in my package . That is, if any task fails I am taking some action and the ForEach loop should continue to process the next file.
Only thing I can think of is to add a package level varaible and modify it with some failure value in the script task and again keep checking at the begining of the Foreach loop. If the vairble has failure value then don't process further tasks below it. The disadvantage with this is the FOREach loop executes without doing anything.
I still beleive there should be someway to stop the package using a script task.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply