`
ezerg
  • 浏览: 268920 次
  • 性别: Icon_minigender_1
  • 来自: 石家庄
社区版块
存档分类
最新评论

DB2 数据表增加非空字段

DB2 
阅读更多

DB2 数据库的表中增加一个非空字段居然会报错,因为以前使用过的 Oracle 和 MySQL 都是可以直接增加的。
有两种方法:
1、增加允许为空的字段,新增字段写入数据后再改为 not null
2、指定非空的同时,指定默认值:alter table test add id int not null default 0


1
1
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics