Converting TIMESTAMP Columns to DATE or TIME
From InterBase
Go Up to DATE, TIME, and TIMESTAMP Data Types
Once you have migrated a database to dialect 3, any columns that previously had the DATE
data type will have the TIMESTAMP
data type. If you want to store that data in a DATE
or TIME
column, follow these steps:
- Use
ALTER TABLE
to create a new column of the desired type. - Insert the values from the original column into the new column:
UPDATE tablename SET new_field = CAST (old_field AS new_field);
- Use
ALTER TABLE
to drop the original column. - Use
ALTER TABLE
…ALTER COLUMN
to rename the new column.