Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SQL 2008 SSIS package Conversion error Expand / Collapse
Author
Message
Posted Friday, December 28, 2012 7:23 AM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Sunday, March 23, 2014 7:35 PM
Points: 129, Visits: 265
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.
Post #1400907
Posted Monday, December 31, 2012 6:15 PM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Yesterday @ 7:42 PM
Points: 176, Visits: 528
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.
Post #1401536
Posted Wednesday, January 02, 2013 7:59 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Monday, April 14, 2014 7:16 AM
Points: 547, Visits: 1,125
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())
Post #1401857
Posted Wednesday, January 02, 2013 9:15 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 4:41 AM
Points: 4,828, Visits: 11,180
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.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #1401907
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse