Subject | Result type in calculated fields |
---|---|
Author | dr_john_mp |
Post date | 2007-10-11T08:59:48Z |
I have an SQL which is
SELECT COLA, ... ,sum(COL1),sum(COL2),(((COl3 * sum(col2)/(col4 +
0.0001)) FROM ... GROUP BY ...
All of columns (COL1..COL4) are defined as NUMERIC - the 0.0001 is
protection against COL4=0
I'm displaying this in a DevExpress grid which identifies the field
type from the presented results. It identifies both of the SUM's as
type currency, and the calculated field as type FMTbcd.
The data appears to be displayed without problems, however if I try
and use the DevExpress features to group the data I sometimes get
BCDoverflow errors for no apparent reason.
I had expected a calculation involving numerics and using floating
point calculations to result in a float. I fixed the problem by using
CAST(((COl3 * sum(col2)/(col4 + 0.0001)) as FLOAT)
DevExpress recognises this, which confirms that the 'incorrect' type
is included in the SQL results.
Can someone explain how this works?
SELECT COLA, ... ,sum(COL1),sum(COL2),(((COl3 * sum(col2)/(col4 +
0.0001)) FROM ... GROUP BY ...
All of columns (COL1..COL4) are defined as NUMERIC - the 0.0001 is
protection against COL4=0
I'm displaying this in a DevExpress grid which identifies the field
type from the presented results. It identifies both of the SUM's as
type currency, and the calculated field as type FMTbcd.
The data appears to be displayed without problems, however if I try
and use the DevExpress features to group the data I sometimes get
BCDoverflow errors for no apparent reason.
I had expected a calculation involving numerics and using floating
point calculations to result in a float. I fixed the problem by using
CAST(((COl3 * sum(col2)/(col4 + 0.0001)) as FLOAT)
DevExpress recognises this, which confirms that the 'incorrect' type
is included in the SQL results.
Can someone explain how this works?