sql 增加修改表格属性字段

1、修改字段默认值

alter table 表名 drop constraint 约束名字 ------注解:删除表的字段的原有约束

alter table 表名 add constraint 约束名字 DEFAULT 默认值 for 字段名称   注解:添加一个表的字段的约束并指定默认值

2、修改字段名:

alter table 表名 rename column A to B

3、修改字段类型:

alter table 表名 alter column name nvarchar(10) not null

4、修改增加字段:

alter table 表名 ADD 字段 类型 NOT NULL Default 0

posted on 2019-05-23 10:18  IT小白鸽  阅读(3609)  评论(0编辑  收藏  举报

导航