Capturing load errors with SSIS / SQL2016

Using SQL 2016 and SSDT for Visual Studio 2015 I’ve been looking for a few weeks how to get an error in loading a .csv file to show the offending column, and the name of the error.

There were some improvements to make this possible via a script object in SQL 2016,  however they’ve moved a few of the functions around which made the code posted online, including on the MS site, outdated.

Here’s the C# code that is working with the latest releases:

public class ScriptMain : UserComponent

public override void Input0_ProcessInputRow(Input0Buffer Row)
 var component130 = this.ComponentMetaData as IDTSComponentMetaData130;
 if (component130 != null)
 Row.ErrorDescription = component130.GetErrorDescription(Row.ErrorCode);
 Row.ErrorColumnName = component130.GetIdentificationStringByID(Row.ErrorColumn);


You can be the first one to leave a comment.

Leave a Comment