读书人

将null字段批改为not null

发布时间: 2012-08-14 10:39:57 作者: rapoo

将null字段修改为not null
先使字段col为空的都填上默认值 ‘0’:
update yourtable set col=0 where col is null

然后再col字段上加not null约束:
alter table yourtable modify column_name datatype not null;

读书人网 >其他数据库

热点推荐