Alter table to drop Default

Database
Teradata Employee

Alter table to drop Default

Hi, 

 

I've to added a Not NULL column to an existing populated table,

thus had to declare a default value as defined as NOT NULL. 

Now as the table is repopulated with appropriate values for the newly added column

want to drop the Default from the data definition as not part of the design.

 

Tried Alter table, but though alter table allows changing from Not Null to null 

unable to Drop the Default constraint (not sure to call it a constraint).

 

The only way left it to create a new table without Default constraint and populate from existing table. 

A better approach to handle this is most welcomed. 

Thanks!! 

  

1 REPLY
Teradata Employee

Re: Alter table to drop Default

As you note, there is no way to remove the DEFAULT attribute. If you ALTER the column to DEFAULT NULL, the DML behavior is the same as if there were no DEFAULT (but SHOW TABLE will display the DEFAULT NULL clause).