Subject | Re: [ib-support] Numeric field used to store currency value |
---|---|
Author | Geoff Worboys |
Post date | 2002-02-12T00:05:13Z |
> I am using Interbase 6.0.1.6But was the database "upgraded" from IB5 via gbak backup and restore??
Note that in such instances "numeric" fields continue to be
implemented as doubles - with the consequential rounding problems.
> I have fields in several tables that I use to store currency valuesYou did not mention which client (and what version of that client) you
> defined as Numeric 15 2
> I have found several entries are listed like this 12.328
are using to display the values. It is possible that the client is
implementing numerics via double or extended and giving you rounding
errors.
Try doing a select in which the columns are cast as string directly at
the server - to see if the problem is server based or client based.
SELECT CAST(MyNumCol AS VARCHAR(20) FROM MyTable
> 1. How can I ensure this does not happen again?If you do have an "upgraded" database then...
Rebuild your database from script and transfer the data explicitly, or
explicitly redefine each of the problem fields within the database and
move the data from the old field to the new field.
> 2. What sql / script can I use to adjust / round to 2 decimal placesThere are rounding functions in the FreeUDFLib.
> these values?
--
Geoff Worboys
Telesis Computing