建表:
create table t1(a int not null,b int not null,c int not null)
加:
alter table t1 add constraint pk_1 primary key (a)

解决方案 »

  1.   

    alter table tablename add constraint pK_tablename primary key (colname)
      

  2.   

    --创建表时直接设置主键create table 表名(
    id int identity(1,1) not null  constraint PK_sys_zj_fielddict primary key  --设置id为标识列+主键
        ,name varchar(1000) not null
    )
      

  3.   

    --在现有表上将某列设置为主键:
    alter table 表名 add constraint pK_名称 primary key (列名)