SQL 字段修改

 

一、修改字段名:post

  alter table 表名 rename column A to Bit

二、修改字段类型:table

  alter table 表名 alter column 字段名 type not nullclass

三、修改字段默认值
  alter table 表名 add default (0) for 字段名 with valuestab

  若是字段有默认值,则须要先删除字段的约束,在添加新的默认值,di

  根据约束名称删除约束co

  alter table 表名 drop constraint 约束名ab

  根据表名向字段中增长新的默认值const

  alter table 表名 add default (0) for 字段名 with values

四、增长字段:

  alter table 表名 add 字段名 type not null default 0

五、删除字段:

  alter table 表名 drop column 字段名;

相关文章
相关标签/搜索