SSIS: If a task fails, how do I make the package continue to the next step (and not fail) but log the error

Hi experts,

I have an SSIS package on SQL Server 2005. It has many steps and several variables, all working ok.

Everything works fine, until a step fails. The whole package stops. I dont' want that to happen. Instead, if the step fails (it's an Execute SQL step, and I'm running a stored proc that does not return anything, but there is a TRY..CATCH Exception in there which causes the failure of the package), then I want to log the error and carry on.

I have a precedence constraint coming from the step to the next step. A "success" constraint path, and a "failure" constraint path.. but the failure step is never reached even though the step is indeed failing.

I have set FailaPackageOnFailure to True on the step itself, but still no joy.

Any suggestions?

Thank you,
rss2
rss2Asked:
Who is Participating?
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
{not sure if this helps, but...}
In your script code, you can raise an error in the code (as opposed to the SP) with the below line of code (modify to suit your needs)

Dts.Events.FireError(-1, "N/A", sErrorDescription, "", 0)
0
 
chapmandewCommented:
>> FailaPackageOnFailure
Shouldn't it be set to False?
0
 
rss2Author Commented:
Intuitively, yes, that's what I thought. False is the default. But I read somewhere to set it to true for what I want to do..so, dont' know. I'll look into that some more.

But regardless, still doesn't change anything, whether that value is left blank, set to True or set to False.

Any ideas?
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
chapmandewCommented:
Ok...look at the screenshot I listed.  In it execute sql task that failed, I have :  SELECT 1/0  which will always cause an error.  In the precedence (error) I just do a SELECT GETDATE(), but you can see that it went to that execute task, even after the first error.
precedence.JPG
0
 
rss2Author Commented:
I did your example and indeed I get what you get. But back in my package, it's not working.

The step that's failing is an Execute SQL step that's running a stored procedure. I have a RAISERROR in the stored proc. When I remove that, the step continues as successful but that's not true.

I have no idea what the problem could be here. :(
0
 
chapmandewCommented:
What is the reason of the failure?
0
 
rss2Author Commented:
There's an insert that is trying to be executed and the error message is:
String or binary data would be truncated.
0
 
chapmandewCommented:
try taking the try...catch out and remove the raiseerror.
0
 
rss2Author Commented:
When I take the try..catch out, and the raiserror, the stored proc still fails of course which is what I'm expecting. But the package step just fails, and despite the failure precedence constraint the entire package stops execution. (i.e. The execute sql step box turns red and the whole thing stops.)

??
0
 
rss2Author Commented:
I had the failure precedence constraint connected to an Execute SQL task that has another connection to it. When I removed that, and created a new one especially for the failure precedence constaint, it worked. Weird!
0
 
rss2Author Commented:
So now the failed step is continuing onto the next step, which executes successfully.

But I'm still getting the problem of the entire package stopping due to the failure, per my question. How do I make the package keep running even though one of the steps fails?

Thanks!
0
 
rss2Author Commented:
As an aside, the issue that was causing the failure of the SQL step was, as I mentioned above, due to too big a string attempting to be inserted into a smaller data type (i.e. trying to push a square into a triangle-shaped hole).

I thought this issue was weird, because all I was doing was taking the raw imported data from a flat file pulled into a sql table.

Turns out, SQL was mixing the rows. So the order of the flat-file was in fact not the order that result in a select on that import table.
http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.sqlserver.integrationsvcs&tid=1cf7c669-1d6c-4dfe-88de-9ce07fd4289a&cat=&lang=&cr=&sloc=&p=1

I believe this is a bug in SQL, but as a work around, I made sure I truncated the staging table that took the raw data in from the flat file (as opposed to a simple delete) before importing the raw data.

Now I don't get that failure on that step anymore!

rss2
0
 
chapmandewCommented:
did you set FailaPackageOnFailure back to false?
0
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Thanks for the grade.  Good luck with your project.  -Jim
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.