?
Solved

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

Posted on 2008-10-06
14
Medium Priority
?
1,599 Views
Last Modified: 2012-05-05
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
0
Comment
Question by:rss2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
  • 2
14 Comments
 
LVL 60

Expert Comment

by:chapmandew
ID: 22652047
>> FailaPackageOnFailure
Shouldn't it be set to False?
0
 

Author Comment

by:rss2
ID: 22652108
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
 
LVL 60

Expert Comment

by:chapmandew
ID: 22652197
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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 

Author Comment

by:rss2
ID: 22652341
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
 
LVL 60

Expert Comment

by:chapmandew
ID: 22652381
What is the reason of the failure?
0
 

Author Comment

by:rss2
ID: 22652416
There's an insert that is trying to be executed and the error message is:
String or binary data would be truncated.
0
 
LVL 60

Expert Comment

by:chapmandew
ID: 22652475
try taking the try...catch out and remove the raiseerror.
0
 

Author Comment

by:rss2
ID: 22657200
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
 

Author Comment

by:rss2
ID: 22657336
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
 

Author Comment

by:rss2
ID: 22657416
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
 

Author Comment

by:rss2
ID: 22657935
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
 
LVL 60

Expert Comment

by:chapmandew
ID: 22658480
did you set FailaPackageOnFailure back to false?
0
 
LVL 66

Accepted Solution

by:
Jim Horn earned 2000 total points
ID: 22659417
{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
 
LVL 66

Expert Comment

by:Jim Horn
ID: 22898108
Thanks for the grade.  Good luck with your project.  -Jim
0

Featured Post

10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question