Altering a table

UDA
Teradata Employee

Altering a table

Hello,

Can I add a key and partitions to a table by using the Alter statement, or are these best handled by creating a new table with the keys and partitions defined and then inserting the old table data into the new? The table is very, very large.

Thanks!

Paul
2 REPLIES
ASW
Teradata Employee

Re: Altering a table


In Teradata ALTER Table will use to add COLUMN,PRIMARY KEY,CONSTRAINT and for DROP COLUMN,CONSTRAINT.
But if you try to add primary key constraint on existing Table,Teradata will create Unique Secondary Index(USI).
If you selectec the column which is already UPI(Unique Primary Index).

If you still need then you have to recreate the table without mention PI.
Teradata will create Primary Key Column as Primary Index column.

Thanks

Re: Altering a table

I think using Alter statement is the best way to do this task...