SSIS - How to perform a task with a script component failure?

I have a Script (Script Transformation) component that should be capable of DFT failure, that is, the data flow task of which it is a part.

I am running an error like this

try { // Does some work here, which can fail... } catch (Exception ex) { bool pbCancel = false; this.ComponentMetaData.FireError(0, Variables.TaskName, "Error message: " + ex.Message, String.Empty, 0, out pbCancel); } 

However, FireError does not crash the task.

Note that this is a Script component inside a data conversion task, not a Script task.

What should I do to complete this task from the Script component?

+7
source share
2 answers

This should be what you are looking for - a 2008 R2 C # script component.

 bool fireAgain = true; IDTSComponentMetaData100 myMetaData; myMetaData = this.ComponentMetaData; //for information myMetaData.FireInformation(0, "SubComponent", "Description", string.Empty, 0, ref fireAgain); //for error myMetaData.FireError(0, "SubComponent", ex.Message.ToString() + ex.StackTrace, string.Empty, 0, out fireAgain); 
0
source

In your example, you are catching an exception but not throwing it. Just add

 catch (Exception ex) { // ... your other code here throw ex; } 

and the component will fail.

0
source

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


All Articles