先去掉主键:
alter table S drop CONSTRAINT pk_s  在新增主键:
alter table S
add constraint pk_S primary key clustered(S_id)

解决方案 »

  1.   

    clustered 这是?在我再新增主键:
    alter table S
    add constraint pk_S primary key clustered(S_id)出错:Server: Msg 8111, Level 16, State 1, Line 1
    Cannot define PRIMARY KEY constraint on nullable column in table 'S'.
    Server: Msg 1750, Level 16, State 1, Line 1
    Could not create constraint. See previous errors.
    好像是说不能对一个可空的加 PRIMARY KEY 
    那我该怎么办?
      

  2.   

    是不是我只能在create 的时候就对要新设的PRIMARY KEY 设为NULL??有没有别的办法!在以后面改???
      

  3.   

    这个错误是由于你的S_id字段是可空的。不能作为主键。
    主键是不可为空而且唯一的。现在的唯一办法是把S_id字段改为NOT NULL。再加主键。