|Subject||Re: Query Problem (Resolved + New Question)|
> Well Paradox is long gone at this point, I actually meant, what isthe best
> way to safely convert my Firebird tables and data from my FLOAT toNUMERIC
> or DECIMAL?There is no simple change data type DML you can run to do the
> BTW, I'm using Firebird 1.5.
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
* 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.
* 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.
* 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).
* Drop the temporary field.
* Reactivate any update triggers
* Recreate any dependencies you initially dropped.