To capture all errors in an SSIS package

Script task to catch all SSIS errors.  I then used an email task to send out the error report.

 

Imports System

Imports System.Data

Imports System.Math

Imports Microsoft.SqlServer.Dts.Runtime

 

Public Class ScriptMain

 

    'Capture Error

 

    Public Sub Main()

        Dim msgs As Collections.ArrayList

 

        Try

            msgs = CType(Dts.Variables("ErrorCollection").Value, Collections.ArrayList)

        Catch ex As Exception

            msgs = New Collections.ArrayList

        End Try

 

        msgs.Add(Dts.Variables("ErrorDescription").Value.ToString)

 

        Dts.Variables("ErrorCollection").Value = msgs

        Dts.Variables.Unlock()

 

        Dts.TaskResult = Dts.Results.Success

    End Sub

 

End Class

Print | posted on Friday, September 11, 2009 10:50 AM

Feedback

# re: To capture all errors in an SSIS package

Left by Craig at 3/4/2014 10:30 AM
Gravatar Hi,

I just found this post and it looks like it might solve an issue I'm working on. But I'm not familiar with Scripting. In SSIS 2012, how do I get this into a script task?

When I tried it, it looked like SSIS was trying to use C.net and this looks more like vb.net.

Thanks

Craig

# re: To capture all errors in an SSIS package

Left by LifeLongTechie at 3/5/2014 10:48 AM
Gravatar There are a few options. One is that you can select what language your script task need to use, and you can choose VB. The other is there are code translator you can find online, and you can try to have that translated into C#.

However, since you are using SSIS 2012, you probably don't even need this if your package is deployed to the SSIS Catelog database. Refer to my other post about running SSIS in SQL 2012. You can change the message setting and just pull out of those error/warning messages from the execution log table.

Your comment:





 

Copyright © Kevin Shyr

Design by Bartosz Brzezinski

Design by Phil Haack Based On A Design By Bartosz Brzezinski