views:

1745

answers:

8

If a file system task such as a rename fails, for example if the file does not exist, then this is considered an error by SSIS. This means the whole package fails. I can get around it by using a script task, or setting the maximum errors for the package to more than one. The problem with setting maximum errors for the package to more than one is that if an error occurs somewhere else in the package the package won't fail when it should.

So is there any way to somehow swallow the error and still be able to branch based on success or failure of the file system task? I tried sticking the file task into a sequence container with ForceExecutionResult set to Success, but the package still fails saying maximum error count reached.

A: 

I've run into this exact problem and I've always used a Script Task. I don't think there's a better solution.

Rob
Good to hear I'm not alone...
Simon D
A: 

I haven't tried this with a FS task, but it works well for dataflows... What about wrapping your filesystem task in a sequence container... If the step fails, the container fails, you could simply output from the container to a success/failure path....

Thanks for the suggestion - I tried using a sequence container but the fact there has been an error in the flow means the package reaches its MaximumErrorCount and fails. I guess Rob's right - no way to do this, which makes the file system task pretty brittle.
Simon D
A: 

Check the FailPackageOnFailure and FailParentOnFailure properties of the FileSystem task and make sure they are set to False. Also, increase the MaximumErrorCount property of the package.

This combination will allow the task to fail and the package to still complete successfully.

Rob Boek
FailPackageOnFailure and FailParentOnFailure are false. (As I mention in my question) I can increase the MaximumErrorCount - but this will mean other errors elsewhere in the package go unspotted. It seems the choice is: lax error checking on no FS task.
Simon D
If you have other items that are important, you can set FailPackageOnFailure to True for those items. Then the package will fail even with an increased MaximumErrorCount. You can also add error handling tasks to decide weather to fail the package or not based on the error.
Rob Boek
A: 

You can use constraint on the connection. Right Click on the connection arrow between SSIS components and you can specify,

Success/Failure and redirect.

A: 

prashant_sp answer is the right one, you just have to continue unconditionnally to the next task, by not selecting the "on success" workflow precedence constraint, but the "redirect" one which will always continue, even if your FS task fails (folder does not exist, etc...)

Kind regards

A: 

You can always try incorporating the "File Watcher Task" which you can download free at http://www.sqlis.com/post/File-Watcher-Task.aspx and adding this as step prior to your File System Task.

Carla
A: 

Use a expression and constraint combination on the "precedence constraint" connector. return success always from your previous task (it may be a script looking for the file) and if file found, set a variable. in the expression of the "precedence constraint" check for the variable value and return true or false. If your expression evaluates to false, the package will nto continue and yet you will not see any error. - Mayukh

Mkh
A: 

Hi Simon,

This question is old but I'm also stuck with it. Did you find out a solution for handling the errors?

I was thinking in decrementing the package error count in an error I don't want to consider, using a script task.

Can you tell me if there is another way or do you know if it is possible?

Thanks in advance,

Bruno Pimenta

Bruno Pimenta
I gave up on File System tasks and used a script task instead, as this allows complete control of the error handling.
Simon D