开发者

how to remove default constraint from column in Db2

开发者 https://www.devze.com 2023-04-10 06:17 出处:网络
I had a table STUDENT_TB, which had column STUDENT_ID, NAME, AGE. I added a column with a f开发者_如何学编程ollowing command :-

I had a table STUDENT_TB, which had column STUDENT_ID, NAME, AGE. I added a column with a f开发者_如何学编程ollowing 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.


I tried with this and it worked properly

alter table STUDENT_TB alter DOB drop DEFAULT


ALTER TABLE STUDENT_TB ALTER COLUMN DOB DROP NOT NULL

0

精彩评论

暂无评论...
验证码 换一张
取 消