ssis error handling newbie (SSIS 2005)
Hi, If you got a minute please give me a hint on this: I am reading a number of text files in a for-each loop, and writing to a db table. Everything works fine. Now I want to add some error handling to this. After processing, my txt files are moved to a directory called "done". When one of the files fails I want it moved to a directory called "error". I placed a new file-system taskbelow the data-flow task and connected them with a failure arrow. It seems to work... But - when the package executes,everything stops when moved the first bad file to "error". No more "good" files will be processed. I want the looping to continue whith more sound files. lots of thanks in advance /RobbanSweden
June 3rd, 2008 4:32pm

In Foreach Loop Container, there is a Data Flow Task and 2 File System Tasks. One File System Task is moving files to "done" and another moving files to "error". 1. Add a variable named IsError, DataType is Boolean 2. In Data Flow Task, use Script task to set variable according to the file handling result. 3. Add constrants between Data Flow Task and 2 File System Tasks. Set constraints EvalOp=Expression. 4. Double click constraints, set Expression: @IsError==true, another one set Expression: @IsError==false. Hope this logic is helpful.
Free Windows Admin Tool Kit Click here and download it now
June 3rd, 2008 6:41pm

Thank You! It does the trick. But, I am curious, is there acleaner way, without extra error-flags? A more convinient way of error event handling at loop container level maybe? Best regards, /RobbanSweden
June 4th, 2008 3:33pm

There is a more professional way. Did you notice the 3rd panel in design window? (First one is Control Flow, second one is Data Flow, third one is Event Handlers). Navigate to Event Handlers panel, in top-left side choose the object you want to get event, in top-right side choose OnError or other events, then you can design what you can do here as the same way you design package. Please see more detailed info here: http://msdn.microsoft.com/en-us/library/ms141717.aspx.
Free Windows Admin Tool Kit Click here and download it now
June 4th, 2008 3:47pm

I'm having the same issue.i don't understand item (2)How do you reference a package variable within a Script Component? I assume you must use this transformation because the script task is not available within the data flow.
November 27th, 2008 1:56am

Well, I now understand how to reference the package variables in the script component. The problem I am having now is that the error output path from my ole db command seems to be executed for both success AND failure of the insert.I don't understand why this would happen?In using the logic above, the result is that the IsError variable evaluates to True each time, and the good files are moved to the bad folder. I thought about using the error description to set IsError, but I can't figure out how to reference this either.
Free Windows Admin Tool Kit Click here and download it now
November 27th, 2008 7:41pm

I decided to abandon the method outlined above and go with the error handler built in to SSIS. In case anyone has similar problems, I found this article to be very helpfulhttp://agilebi.com/cs/blogs/jwelch/archive/2008/06/29/continuing-a-loop-after-an-error.aspxWhat I've learned through the past few days is that there are a lot of subtleties with error handling in each task/container and that the Max error property is an important setting. I'm sure there is a lot to learn on this subject, and unfortunately not a lot of documentation out there.
November 28th, 2008 7:09pm

I had the same problem, and I found a different solution: Increase the MaximumErrorCount property to what you think is acceptable. Note: one file can create more than one error. In my case it was 4 errors. I raised the MaximumErrorCount to 12 to except 3 corrupt files.
Free Windows Admin Tool Kit Click here and download it now
February 16th, 2011 10:26am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics