SQL 2008 SSIS package Conversion error

  • Hi

    I have a package loading data from a flat file to a table. At about 90,000 rows one of the columns fails the pakage with the error:

    [Destination - SCORECARDAPP [618]] Error: There was an error with input column "CORPOL25_DOLL_60P_PCT" (2316) on input "Destination Input" (631). The column status returned was: "Conversion failed because the data value overflowed the specified type.".

    I have setup a redirect for the column on the flat file source as well as the destination but I am unable to get the data causing the error to redirect and the package fails at that point. The data type for the column is decimal scale 9 on the flat file and the destination is column is [decimal](9, 9). Any Ideas would be greatly appreciated.

  • I suggest you divide and conquer to identify the data with the issue.

    Either slice your source file up into chunks and iteratively load it to identify the offending row(s)

    OR load the file into a table consisting of VARCHAR(8000) columns, and an identity column to give you the source row number, then select the data and cast on the fly to find the row with the problem:

    SELECT CAST(CORPOL25_DOLL_60P_PCT,DECIMAL(9,9)) As Test FROM YourTempTable WHERE YourIdentityColumn BETWEEN 90000 and 95000

    Its a brute force method but it lets you identify the exact piece of data causing the issue.

  • Try bringing in the decimal field as varchar(50) and then using a derived column transformation to convert it rather than doing everything in the flat file connection manager. You should then be able to catch the error.

    Or bring it to a staging table that is unconverted (all fields varchar for example) then convert it as a second stage which is what I do for a big daily import, combining unformated data from several flat files into each staging table.

    If the conversion is then part of an input select statement eg select convert(decimal(9,9), myvalue) etc

    then use a case statement to validate the number

    e.g. select case when isnumeric(myvalue) then convert(decimal(9,9), myvalue) else null end....

    and so on.

    I found this is also useful with dates (using isdate())

  • P Jones (1/2/2013)


    Try bringing in the decimal field as varchar(50) and then using a derived column transformation to convert it rather than doing everything in the flat file connection manager. You should then be able to catch the error.

    Or bring it to a staging table that is unconverted (all fields varchar for example) then convert it as a second stage which is what I do for a big daily import, combining unformated data from several flat files into each staging table.

    If the conversion is then part of an input select statement eg select convert(decimal(9,9), myvalue) etc

    then use a case statement to validate the number

    e.g. select case when isnumeric(myvalue) then convert(decimal(9,9), myvalue) else null end....

    and so on.

    I found this is also useful with dates (using isdate())

    Getting slightly off-topic, but IsNumeric is likely to give you some false positives. Try these, for example:

    select isnumeric('+')

    select isnumeric('-')

    select isnumeric('1e2')

    select isnumeric(CHAR(9))

    select isnumeric('-1,2,3,4,56,789')

    select isnumeric('12222D3')

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply