On Mon, 9 Jul 2001, Bhuvan A wrote:
> can any one say how can we change the table definition once
> created?
>
> say, we have a table with 1000s of records. if one needs
> to change the data type of particular column or if he
> needs to change the width of a column what should be
> done?
>
> As of now, i am copying the data to a file(COPY COMMAND) and
> creating a new table after deleting the old one and copying
> the content of that file to the new table.
>
> is it the only way to do it?
Not quite. Right now, you will need to make a new table, but
you can use alter table rename and insert ... select to make your
life a little easier... Something like:
create table new ... ;
insert into new (...) select ... from old;
alter table old rename to old_backup;
alter table new rename to old;
(drop old_backup when you're sure it's safe)