Data Type Conversion BIGINT to INTEGER

Database
Enthusiast

Data Type Conversion BIGINT to INTEGER

I want to change  the datatype of few columns in one table from BIGINT to INTEGER. (Table is not Empty)

Is there any Alter Table statement or i have to used new table and then copydata and rename ??

Please suggest

2 REPLIES
Enthusiast

Re: Data Type Conversion BIGINT to INTEGER

Its always better to create a new table and then copy the data.

Enthusiast

Re: Data Type Conversion BIGINT to INTEGER

Replacing BIGINT with INTEGER in new tables: some issues in joins ?

About changing datatype from now when creating new tables for an application existing column (ID_COL):

i just wonder wether a use of INTEGER instead of BIGINT could impact join performances between historical tables and new tables ?

HIST.ID_COL (BIGINT) JOIN NEW.ID_COL (INTEGER)

Well, except the fact a same column with two datatypes is not suitable in a physical model ...

NB: BIGINT is a waste of space when ID value is never above 110 000 000 and tables count some 50 billions lines.

Pierre