alter column with default value
This question already has an answer here:
ALTER TABLE查询为拒绝登录添加默认值0
If you want to affect existing rows, then use with values
:
alter table enquiry
add constraint dft_enquiry_rejectreason default 0 with values;
This is explained in the documentation:
. . . WITH VALUES
can be used to store the default value in the new column for each existing row in the table.
Use ADD CONSTRAINT like
ALTER TABLE enquiry ADD CONSTRAINT some_name DEFAULT 0 FOR RejectReson;
链接地址: http://www.djcxy.com/p/24704.html上一篇: 如何为现有列设置默认值
下一篇: 使用默认值更改列