简体   繁体   English

如何从Db2中的列中删除默认约束

[英]how to remove default constraint from column in Db2

I had a table STUDENT_TB, which had column STUDENT_ID, NAME, AGE. 我有一个表STUDENT_TB,它有一个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. 对于DOB列,我不希望它为null。 Now i need to remove that default constraint. 现在我需要删除该默认约束。

I tried searching but not got any success. 我试过搜索但没有取得任何成功。

Regards. 问候。

我试过这个,它运作正常

alter table STUDENT_TB alter DOB drop DEFAULT

ALTER TABLE STUDENT_TB ALTER COLUMN DOB DROP NOT NULL

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM