Question

I am having an issue with a derived column calculation in SSIS not returning the correct values. To give some background, I had to change the format of my calculation due to an overflow issue (resolved), see here - SSIS - Derived Column Calculation Error

Now, the old and new calculations return different values in SSIS, even though they are both mathematically the same and return the same value when executed in .net, excel and SQL.

In .Net -

decimal test1 = Convert.ToDecimal((415 * 415 * 415) * 0.000000030940000);
decimal test2 = Convert.ToDecimal((0.000000030940000 * 415 * 415 * 415));       

both return 2.2113862225

In SSIS -

test1 = ((415 * 415 * 415) * 0.000000030940000)
test2 = (0.000000030940000 * 415 * 415 * 415)

return different values (test1 = 2.2113862225 and test2 = 2.211535)

Interestingly, SSIS sees test1 as a numeric (38,6) and test2 as a numeric (27,15)....

Has anyone encountered this issue before?

I don't really want to have to re-factor the whole package to use .net calculations, however that will be my last resort solution.

Was it helpful?

Solution

In case anyone else has this problem - I didn't find the solution but did implement a workaround -

Instead of doing the calculation in a derived column -

  1. Use the derived column component to reate the variable and set it as 0
  2. Add a data conversion and switch it to the required data type (float in this case)
  3. Add an OLE DB Command to call a stored procedure to do the calculation, with an output parameter filling the variable created at point 1.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top