create table ai( i int ,ii int)
insert into ai select 1,2
insert into ai select 2,2
insert into ai select 3,2
go
select * from ai
go
alter table ai add UNIQUE(i) /*给列i加入唯一性约束*/
go
select * from ai
go
SQL SERVER企业管理器-->右键你的表-->设计表-->选中你要设置标识的字段(必须是int类型)-->下面有个属性叫“标识”的,选“是”,你可以按你的要求改一下标识种子或标识递增量,然后保存该表的设计。
或
create table aa(id int identity(1,1),F1 varchar(20))
或
alter table bb add id int identity(1,1)