--添加列
ALTER TABLE t ADD Mycolumn int identity(1,1)||not null default(0)
--删除列
alter table t drop column Mycolumn 
--修改列
alter table t alter column Mycolumn varchar(20) not null--将表中的数据改为为小数
update t
set groups=cast(groups as DECIMAL(10,3))
--将表字段的类型更改小数
alter table t alter column Yourcolumn DECIMAL(10,3))
------------------------------约束操作----------------------------------
--加约束(默认值)
Alter table t Add constraint C_Mycolumn default(30) for Mycolumn 
--加约束(check条件)
alter table dbo.t add constraint ck_t check ('字段'<>'字段')alter table t with nocheck 
add constraint t_sex check([name] in(N'男',N'女'))
--加约束(主键)
alter table t add constraint t_id primary key(id)
--删除约束
alter table t drop constraint [DF_t_Mycolumn]
--加列加约束(默认值)
alter table t add Mycolumn int CONSTRAINT [DF_t_Mycolumn] not null default(0)