Migrating NUMERIC and DECIMAL Data Types
From InterBase
Go Up to About NUMERIC and DECIMAL Data Types
Read Do you really need to migrate your NUMERIC and DECIMAL Data Types? to decide whether you have columns in a dialect 1 database that would be best stored as 64-bit integers in a dialect 3 database. If this is the case, follow these steps for each column:
- Migrate your database to InterBase 6 and later as described in Method One: In-place Migration.
- Use the
ALTER COLUMN
clause of theALTER DATABASE
statement to change the name of each affected column to something different from its original name. If column position is going to be an issue with any of your clients, useALTER COLUMN
to change the positions as well. - Create a new column for each one that you are migrating. Use the original column names and if necessary, positions. Declare each one as a
DECIMAL
orNUMERIC
with precision greater than 9. - Use
UPDATE
to copy the data from each old column to its corresponding new column:UPDATE tablename SET new_col = old_col;
- Check that your data has been successfully copied to the new columns and drop the old columns.