1

I have a requirement that is columns validation in the Script component. If the column value found null it should be stopped task with red cross mark and then the task should be the exit.

I have used below code to fail the script component task. But it's not stopping the task, it passing the next code line.

DTSExecResult result;
result = DTSExecResult.DTSER_FAILURE;
Hadi
  • 36,233
  • 13
  • 65
  • 124
gopim
  • 35
  • 6

2 Answers2

1

If you just force an error and prevent further execution from the Script Component you can throw an error as done below. However you'll want to make sure this is defined well enough to distinguish it from any other errors that may occur.

public override void Input0_ProcessInputRow(Input0Buffer Row)
{
    if (Row.Column1_IsNull)
    {
        throw new Exception("Error Message");
    }
}
userfl89
  • 4,610
  • 1
  • 9
  • 17
  • Thanks for the suggestion. Currently, I tried with Environment.Exit(0); It's working fine, I will use that throwing Exception if I faced any issues at deployment in QA – gopim May 09 '19 at 15:31
  • @gopi You should mark this as the answer if it achieves the desired solution. – J Weezy May 09 '19 at 15:36
0
Dts.TaskResult = (int)ScriptResults.Failure;

return this from the script task

Nayan
  • 84
  • 6