SSIS empty int flat file fails in load

advertisements

I have an SSIS package I am using to load a Fixed Width flat file. I have put in all the column lengths and have two packages against similar files working correctly. The third however keeps throwing the following error:

[Source 1 [16860]] Error: Data conversion failed. The data conversion for column "Line Number"
returned status value 2 and status text "The value could not be converted because of a
potential loss of data.".

[Source 1 [16860]] Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR.
The "output column "Line Number" (16957)" failed because error code 0xC0209084
occurred, and the error row disposition on "output column "Line Number" (16957)"
specifies failure on error. An error occurred on the specified object of the specified
component.  There may be error messages posted before this with more information about
the failure.

After doing some testing this happens for any column I have the is using the DT_I4 Data Type and has a blank in the column. I was going to try using a derived column, but this seems to fail for some of the columns even if I change them to a string data type to handle the blank as a NULL and then do a conversion to an INT later in the data flow.

In the source and the destination task I have the Retain NULL values checkbox ticked however this hasn't changed anything.

Any suggestions on handling this error where INT seems to fail at converting a blank to a NULL?


DT_I4 maps to a four byte signed integer in SSIS.

You were on the right track with your derived column. You just need to add the right expression.

You can try this expression:

ISNULL([Line Number]) ? "0":[Line Number]

This link may also be of use - see the postcode column in the example http://www.bidn.com/blogs/DonnyJohns/ssas/1919/handling-null-or-implied-null-values-in-an-ssis-derived-column