Subject Re: Query Problem (Resolved + New Question)
Author Adam
> Well Paradox is long gone at this point, I actually meant, what is
the best
> way to safely convert my Firebird tables and data from my FLOAT to
NUMERIC
> or DECIMAL?
>
> BTW, I'm using Firebird 1.5.

There is no simple change data type DML you can run to do the
conversion, and given that Float is a 'lossy' data type (precision at
the expense of accuracy), there is no possibility of recovering the
lost accuracy, so no-one can give you a 'safe' method of getting the
data back. This is basically the steps involved in changing the field
type.

* You will need to firstly identify a more appropriate field type to
hold your data. You will need to consider the accuracy, precision and
range of your data.
* Drop any dependencies on the float field (eg constraints / indices /
procedures / views / triggers that reference this field).
* Disable any update triggers on the table.
* Add a temporary field of the numeric/decimal type you selected.
* Commit;
* Run an update statement to copy fields from the float to the temp
field. Note that some accuracy will have been lost by storing it as a
float. You may need to use a cast or rounding function to avoid an
exception when the float number is too big.
* Commit;
* Drop float field.
* Create numeric/decimal field with the same name as your float.
* Run an update statement to copy the values back to the original
field (which now has a new type).
* Commit;
* Drop the temporary field.
* Reactivate any update triggers
* Recreate any dependencies you initially dropped.

Adam