Monday, March 19, 2012

Detailled error description in a script component (data flow)

Hi,

I'm pretty new in SSIS and i have some problems with error log. I want to get detailled error description in a script component of a dataflow. for the moment I use thooses lines

Row.ErrorDesc = ComponentMetaData.GetErrorDescription(Row.ErrorCode)

and for unique constraints on a sql table I have this error : The data value violates integrity constraints.

For the same error, if i use an event handler on error, i have more row and the first of them is more explicit (Variable System::ErrorDescription)

An OLE DB error has occurred. Error code: 0x80040E2F.
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80040E2F Description: "The statement has been terminated.".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80040E2F Description: "Cannot insert duplicate key row in object 'dbo.dimDepot' with unique index 'IX_dimDepot'.".

Is that possible to have a so detailled error text in a script componnent of a data flow? If yes, How?
Or if i use error event how can authorize the dataflow go ahead even if there is error.

thanks for you help

krest

Having written on the inadequate specificity of OLEDB error messaging available to the data flow as compared to that available to the OnError handler from the underlying SQL Native client, the following route was chosen to circumvent the problem.

Use the ADO.NET destination available in the SSIS Integration Services book written by Kirk Haselden.

Two modifications to the provided ADO.NET destination component in the book were made, to do exactly what you're looking for: inject detail error descriptions/codes as columns in the error output, to allow for their use when error row redirection is desired. They are as follows:

1. With the ADO.NET destination component, add two columns to the error output, NativeErrorMessage (type DT_WSTR ) and NativeErrorCode (type DT_I4).

2. Modify the error handler to populate the NativeErrorMessage and the NativeErrorCode from the the SqlException object.

I would post the code, but I'm not certain if that's allowed by the author or not.

No comments:

Post a Comment