Wednesday, March 28, 2012

I4 to I8 in Aggregation

I'm using an Aggregation task to summarize an input file by item and week before inserting it into a SQL table.

Two of the fields I'm summing, because their totals per record can occasionally exceed 32k, are defined as int (I4) instead of smallint (I2). However, the summarized total never exceeds the value an int can hold.

I ran into a problem on the insert, however, with SSIS telling me it couldn't insert an I8 value into an I4 table field. I discovered the metadata for the summed totals had automatically been set to bigint (I8), and the mapping was failing.

I didn't see a way to change that metadata within the Aggregation task itself, so I added a Data Conversion task to convert the totals to four-byte signed integers and enable the mapping. Was that the proper workaround?

Based on your problrem description, it is the workaround that I would have used, for what that's worth.

No comments:

Post a Comment