views:

29

answers:

1

Here when task is failed in Script Task, I always get a result as "Error: The script returned a failure result" in the Progress/Execution Result Tab, which I am unable to identify what error had occurred. Inside the script task, I have given the code for failed result, as shown :

Dts.TaskResult = (int)ScriptResults.Failure;

How will I identify what error had occurred inside the Script Task ? What should I apply inside the code ?

A: 

You can debug the script task by just setting a breakpoint in the code.

If you want you can also use MsgBox to show the error details but a logging solution would be more elegant one ( Dts.Log ).

orka
the problem is i already deployed this package in the server. and also scheduled a job for this, to execute the package daily. Two or three times, the package had failed while executing based on scheduled job.and it was Script task failure. The result which I am getting is "Error: The script returned a failure result". Inside the Script Task, coding section, I have given, to catch an exception. How will I return this Exception message instead of the default error message which I had specified above, which would be easy to identify and also we can avoid by checking, using Breakpoint.
Sreejesh Kumar
In your case, you can't easily determine what causes the error without changing the code in the script component. You should better add a logging functionality (use DTS.Log function) and re-deploy your package.
orka

related questions