--主键约束
alter table Test
add constraint PK_Id primary key (Id)
--检查约束
alter table Test
add constraint CK_Name check(Name like '_')
--建表,并加主键约束。与自动增长列
if exists(select name from sysobjects where name = 'Test')
drop Table Test
go
create table Test
(
Id int primary key identity(1,1) not null,
Name varchar(10)
)
上面一位朋友好像有语法错误.
温馨提示:答案为网友推荐,仅供参考