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:

  1. Migrate your database to InterBase 6 and later as described in Method One: In-place Migration.
  2. Use the ALTER COLUMN clause of the ALTER 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, use ALTER COLUMN to change the positions as well.
  3. 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 or NUMERIC with precision greater than 9.
  4. Use UPDATE to copy the data from each old column to its corresponding new column:
    UPDATE tablename
    SET new_col = old_col;
    
  5. Check that your data has been successfully copied to the new columns and drop the old columns.

Advance To: