Wednesday, 05 February 2014 11:12

Get the error message in the script task

Share this post

When you execute a SSIS and a script task failed, you have only the message indicating the script task failed.

To retrieve the error message, here is the solution. Use a try catch bloc and write the error in the log.


Try 
        'Write your code here 
	
	'Return the succes result 
	
	Dts.TaskResult = Dts.Results.Success 
Catch ex As Exception 
	' post the error message we got back. This is the old error catch code that might work better with SSIS. 
	Dts.Events.FireError(0, "Script Task Error", ex.Message.ToString(), String.Empty, 0) 
	
	'Return the Failure result 
	Dts.TaskResult = Dts.Results.Failure 
End Try 

Read 27901 times Last modified on Wednesday, 05 February 2014 11:36