how to remove default constraint from column in Db2

11,367

Solution 1

I tried with this and it worked properly

alter table STUDENT_TB alter DOB drop DEFAULT

Solution 2

ALTER TABLE STUDENT_TB ALTER COLUMN DOB DROP NOT NULL

Share:
11,367
M.J.
Author by

M.J.

I am a software developer currently working on technologies like Java, Hibernate, Toplink majorly.

Updated on June 17, 2022

Comments

  • M.J.
    M.J. almost 2 years

    I had a table STUDENT_TB, which had column STUDENT_ID, NAME, AGE. I added a column with a following command :-

    alter table STUDENT_TB add DOB TIMESTAMP NOT NULL DEFAULT CURRENT TIMESTAMP
    

    as for the DOB column i didn't wanted it to be null. Now i need to remove that default constraint.

    I tried searching but not got any success.

    Regards.