Set Property ForeExecutionResult of a Task to Skip Error of a Task within a Package


I have a need to send email alert when an FTP job task with WinScp generates error(s) but I still want the workflow to continue.
I have created an Event Handler for OnError event to retrieve a variable from the FTP task to send dbmai through an Execute SQL Task:
EXEC msdb.dbo.sp_send_dbmail

I can set the property “ForeExecutionResult” of the FTP task to Success to continue the job.
Within the FTP job I use



 if (winscp.ExitCode != 0)
                                  
                    Variables lockedVariables = null;
                    Dts.VariableDispenser.LockOneForWrite("ConcatenatedError", ref lockedVariables);
                    lockedVariables["ConcatenatedError"].Value = "XX GM FTP File Error!";
                    lockedVariables.Unlock();

                    Dts.Events.FireError(0, lockedVariables["ConcatenatedError"].Value.ToString(), "FTP Error", String.Empty, 0);
}



 

to trigger the OnError Event Handler and pass a value to the SSIS variable to be consumed for dbmail.
I have a series of 8 FTP tasks and the code can send email out only for those that are running into problems and the package will continue to finish.

http://sqlblog.com/blogs/rushabh_mehta/archive/2008/04/24/gracefully-handing-task-error-in-ssis-package.aspx

Advertisements


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s