Ignore errors on Execute Package task in SSIS - ssis

In an SSIS package, I have a For Loop Container task with the EvalExpression set to true (so that it runs forever). If any tasks inside the For Loop Container fail, then the package must fail -- except for the Execute Package task (that calls a child package). If that fails, then the parent package should move onto the next task.
I tried setting the MaximumErrorCount of the Execute Package task to 0, but that didn't help.
I tried setting the MaximumErrorCount of the For Loop Container task to 0, but that ignores the errors of all the tasks within the For Loop Container task.
Any idea how I can ignore errors on only the Execute Package task -- within a For Loop Container.

A better way to do this is to go to the OnError handler of your execute package task and set the System variable "Propogate" to false. This will stop the error from bubbling upwards to your loop container.

The answer is to use the FailPackageOnFailure property for all the tasks that should cause the package to stop and set the MaximumErrorCount of the For Loop Container task to 0.
I got the answer here:
http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?&query=Ignore+errors+on+Execute+Package+task+in+SSIS&lang=en&cr=&guid=&sloc=en-us&dg=microsoft.public.sqlserver.dts&p=1&tid=6406db48-a2cb-4b0d-a124-4892e976a583

Go to "Event Handlers" on top
On the left side choose required "Executable:"
Go to "Event Handlers" on top
In the middle click on "Click here to create 'OnError' event handler for executable 'xxx'
Go to "Package Explorer", find newly created 'OnError' event -> Variables -> Propogate
In the properties change value to "false"
Done

Related

SSIS ForceExecutionResult not working

I have a package, inside which contains a script task, due to probably C# library issues in some of the servers, this task may success in some machines but fail in others (reporting Cannot load script for execution).
I want to force the task to be success by setting the ForceExecutionResult = Success option for this task. However when running, I found this doesn't work, the task still fails in the old-fashioned way.
I don't want to modify the MaxErrorCount for package because I want to reveal errors from other components, in the meanwhile, even this script task fails during validation, I want the package report success, is there any way to make the solution?
To let your package continue execution, you can set the DelayValidation property to True on the Script Task (so the package will begin executing), then on the Precedence Constraint that follows this Script Task, set it to continue on completion, instead of success.

Execute SSIS Task More Than Once

I am relatively new to SSIS. I have two script tasks. If either task fails, the error handling logic is the same. The second script task must always execute regardless if the first script task has failed.
I have created the above as shown in the image link below. However, It seems the error handler task is only executed once. So if both script tasks terminate in error, the error handler is not executed for the second script task (presumably because it was already executed after the first script task.
Is there anyway to achieve this or do I simply have to duplicate the Error Handler task for both script tasks.
see SSIS Image below
You would need to duplicate the task to have it execute twice.
One way to have this event fire twice while only defining it once is to set up an event handler.
To do this, navigate to the 'Event Handlers' tab.
You'll see there is a dropdown on the right, where you can select the event handler type. Here you'd probably want either OnTaskFailed or OnError. OnTaskFailed fires once per failed task, whereas OnError fires for every error that occurs within a task.
On the left, you can select the executable, which allows you to define a scope for the event handler. If you scope this to the package, you'll have event handlers executed for every task in the package. If there are more tasks in your package than the two Script Tasks you've shown in your post, and you only want it fired for those two, you could put them into a Sequence Container (in the Control Flow), and then scope the event handler to that Sequence Container.
You then just click the text in the middle of the pane to create a handler, and add the necessary tasks there (it works in a similar way to the Control Flow).
The event handler will now execute for both tasks.
It's also worth mentioning that within these handlers are lots of useful system variables you can use, e.g., System::ErrorDescription in OnError.
What I've described will look something like this:

SSIS 2008 User Variable in Expression for Execute Process Task

I have an SSIS 2008 package.
I have 3 user variables in the package. One is for an the environment, one is for the path for an executable, and the other is part of a message for an email.
I have a Script Task that sets the variable for the path (strAppPath) based on the environment variable.
strAppPath is used in an expression for the Executable property of an Execute Process Task. The job fails stating that the executable path for the Execute Process Task is not set.
I'm assuming that it is checking this path before the Script Task sets the variable.
Is there a way to work around this?
Right click on your Execute Process Task and select Properties. In the properties window, you will have a DelayValidation option that is currently set to False Flip that to True.
What is happening is that when the package starts, it goes through a validation phase to ensure everything is kosher before it begins (no need to start processing if something is broken). In your case, that full validation is not desired as the Execute Process Task won't be valid until right before it's time to run. The validation will occur, just that it is delayed until it is time for the task to begin. Make sense?

How can i stop the package with more than 1 dataflow if the first fail?

I've a SSIS package with more than 1 data Flow, If the 1st Dataflow fail I don't want to execute the follows. How can I stop the execution of the package. I tried using red arrow and script task doing nothing but I it doesn't work. the others dataflows are executed as well getting all the errors to my .net client. I need only the error for the Data flow that fail.
Anyone know how can I get it
Thanks
You can set MaximumErrorCount To 1 on your data flow task, but this is the default value. Same goes for the value at package level, if you set this to 1, the package terminates with error if you task fails.
But as i said, these are default values and you shouldn't have anything to do. Do you execute the data flow tasks all together? If you do, build one path which executes all the tasks after another.
You can use the Squence Container and put all the data flow task in it. I have shared the screen shot of the sample, adjust the priority for all the data flow task and put sucess condition for the tasks.

Resume Parent package even Child Package fails

I am using Execute Package Task in my job to call my child Packages. I use an execute SQL Task to get my file location and file name to load the file into my tables.
Once I get these details I'll pass this information to my Execute Package task, where upon it calls my child Package.
My query triggers 2 input files, which has to be loaded into my tables.
For example, let us assume file1.csv and file2.csv has to be loaded. So when file1.csv is loading, if there is any error in my child package, my child package fails and my parent package does too. It should not happen like that; if my file1.csv fails to load, my child package and parent package should not fail and should continue loading file2.csv.
For this I tried changing the Propagate System variable value to false for execute Package task for On Error Event, still I couldn't solve the problem.
You can
Handling the error by setting up a failure path after the task that possibly fails
Set the MaximumErrorCount to a higher value (click into the background of your control view and go to properties)