Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQL 2008 SSIS package Conversion error


SQL 2008 SSIS package Conversion error

Author
Message
jdbrown239
jdbrown239
SSC-Enthusiastic
SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)

Group: General Forum Members
Points: 161 Visits: 390
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.
nick.mcdermaid
nick.mcdermaid
SSC-Enthusiastic
SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)SSC-Enthusiastic (199 reputation)

Group: General Forum Members
Points: 199 Visits: 765
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.
P Jones
P Jones
Say Hey Kid
Say Hey Kid (682 reputation)Say Hey Kid (682 reputation)Say Hey Kid (682 reputation)Say Hey Kid (682 reputation)Say Hey Kid (682 reputation)Say Hey Kid (682 reputation)Say Hey Kid (682 reputation)Say Hey Kid (682 reputation)

Group: General Forum Members
Points: 682 Visits: 1505
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())
Phil Parkin
Phil Parkin
SSCrazy Eights
SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)

Group: General Forum Members
Points: 8310 Visits: 19454
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')




Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search