Numeric Scale is truncated in Derived Column
Hi, I have a derived column in a control flow which is doing a simple division and should have a result of of a column with a percision and scale of (38,10). The source column on the left side of the equation is Numeric( 38,22) and the source column on the right is int. I originally was converting the result to 38,10 and my calculation looked like this: (DT_Numeric, 38,10)( Column1 / Column2 ). The sample data that I am having a problem with is: 840.221923076923 / 3490 = 0.2407512674 However, the result that I am getting in ssis is 0.24075100000 Why is SSIS dropping off the last for digits? I tried removing the data conversion from the calculation, or adding data conversions before each part of the equation, but I am getting the same result. Is there something else I can try? Mark
November 8th, 2010 11:19am

The source column on the left side of the equation is Numeric( 38,22) what is the SSIS data type of column? I mean in the source , right click select advanced editor and in input and output columns , under output columns, select that column and look at what is the datatype there?http://www.rad.pasfu.com
Free Windows Admin Tool Kit Click here and download it now
November 8th, 2010 11:36am

It is Numeric(38,10) for the output column Numeric 38,15 for the input column which is the left part of the equation.
November 8th, 2010 11:51am

could you put a dataviewer between source and derived column transformation and check if the 840.221923076923 value returned correctly from the source or not? for adding a dataviewer, right click on datapath ( green arrow ) between source and derived column transformation , then add , select grid with default settings. now in the runtime you will see a table which shows data in the data path. check values which are correct or not?http://www.rad.pasfu.com
Free Windows Admin Tool Kit Click here and download it now
November 8th, 2010 11:55am

Yes, I actually did that initially in my troubleshooting, which is where I came up with the sample information. I have arrived at a solution, but I would really like to understand why it works. I have left alone the first part of the equation, but I converted the right part to numeric(10,1). If this was left as an integer, it seems that SSIS implicitly converts this to 38,6. When I add that decimal place, it then converts it to 38,14 -- which is a big enough number for my desired result. This seems counter intuitive, I had tried solving this in the first place by convertin my denominitor to 38,10. I thought the bigger the scale of the denominator, the bigger the scale of the result. It seems, it some respect th opposite is true? Is something in BOL where I could learn more about this type of implicit conversion? Mark
November 8th, 2010 12:25pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics