首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

将null字段批改为not null

2012-08-14 
将null字段修改为not null先使字段col为空的都填上默认值‘0’: updateyourtablesetcol0wherecolisnull 然

将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;

热点排行