Return current SSIS counter

The SSIS package has a MaximumErrorCount property. Using this property implies that during the execution of a package, the number of errors is counted by the package.

At different points during the execution of a particularly complex set of packages (which, as a rule, MaximumErrorCount are set to higher levels at different points), I would like to be able to fix the current error counter, but I can not find a mechanism for this.

Ideally, this would be a system variable (this is not as far as I can see), so I could build expressions against it on my own, but worst of all, I canโ€™t find a way to capture it in a script either (my VB skills. net is bad, so I might have missed this, but I searched and searched in the object browser without success).

Any SSIS guru knows how I can capture the current error counter at specific points during package execution?

(I tried to inject a simple variable increment into the package-level OnError event handler, but in rare cases this does not seem to synchronize with the actual number of errors โ€œcountedโ€ by the engine. And in any case, if there is a built-in counter, this would be very preferable and more elegant)

Thanks in advance.

+5
source share
1 answer

Typically, restrictions are used to limit the flow of error handling. that is, if a specific task is not performed, direct the control flow with a failure limitation. If you want to create a tolerance based on the number of errors, you will need to commit each error in a variable after each task (again, using the constraints and the script task).

I do not think that there is a set counter that contains the current number of errors for a task or container, but such a counter will be bound to each object and the package itself. It seems like it would hurt to work, even if you could understand it.

My suggestion will use everything out of the box as far as you can:

  • Use restrictions to control success and failure behavior
  • Do not use event handlers because they look like an invisible GOTO, and you never know where they are.
  • keep working with the code so that it succeeds rather than fail. It is scary to raise the maximum number of errors and never know that something went wrong. I mean, if you do not need your data. In this remark, I am not so relevant - this may be quite acceptable behavior when transferring data to a test environment.
  • Use variables sparingly. Some of these packages probably have a few key points that need attention, so don't add a maze of variables that will become even harder to fix and maintain. If you can reduce the maximum error counter to 1 over time, you are likely to change only a few points in packages (80/20?). If you really need to rewrite all of this, okay ... then that was shit to begin with and a good deliverance, right?
+3
source

Source: https://habr.com/ru/post/1201337/


All Articles