Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread BCD in ElevateDB shoudl I use a Decimal or Float?
Wed, Jan 14 2009 6:34 PMPermanent Link

Phil Read
Hi all,

Moved to ElevateDB and all the tables I migrated from DBISAM that used
Currency have defaulted to Float. Not to be honest I I moved to BCD size
2 for storing monetary values in DBISAM as it was more precise than the
Currency with rounding errors etc

So taking that into consideration, what should I be using in ElevateDB
to store monetary values? Should I be using a Decimal with a scale of 2
or something else?

Thanks,

Phil.
Thu, Jan 15 2009 10:31 AMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Phil,

<< Moved to ElevateDB and all the tables I migrated from DBISAM that
used Currency have defaulted to Float. >>

In DBISAM, "Currency" fields are the same as "Float" fields (except for
the display format) and the equivalent of the "Double" Delphi variables
and ftCurrency TFieldType, so the migration process behaved as expected
transforming "Currency" fields into FLOAT columns. The equivalent SQL
type was MONEY, that is no longer supported in EDB.
On the other hand, BCD fields (DBISAM) are equivalent to the "Currency"
Delphi variables and to ftBCD TFieldType and, when migrated to EDB, are
equivalent to the DECIMAL SQL type.

<< So taking that into consideration, what should I be using in
ElevateDB to store monetary values? Should I be using a Decimal with a
scale of 2 or something else?>>

If you want an exact representation and you don't need more than 4
decimal places, yes, you should be using DECIMAL column types ( and the
equivalent "Currency" Delphi variables).

--
Fernando Dias
[Team Elevate]
Sun, Jan 18 2009 1:35 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Phil,

<< So taking that into consideration, what should I be using in ElevateDB to
store monetary values? Should I be using a Decimal with a scale of 2 or
something else? >>

Yes, DECIMAL with a scale of 2.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image