ALTER TABLE [dbo].[student] WITH NOCHECK ADD 
CONSTRAINT [PK_student] PRIMARY KEY  CLUSTERED 
(
[ID]
)  ON [PRIMARY] 
GO

解决方案 »

  1.   

    alter table student add
    constraint PK_id primary key (id)
      

  2.   

    ALTER TABLE dbo.A1 ADD CONSTRAINT
    PK_A1 PRIMARY KEY CLUSTERED 
    (
    ID
    ) ON [PRIMARY]
      

  3.   

    --添加not null约束
    alter table student alter column ID int not null
    go
    --设置主键
    alter table student add constraint con_PK primary key(ID)
      

  4.   

    不是很明白,哪位能解釋一下。
    我試了一下也不是很好用
    Table 'student' already has a primary key defined on it.
      

  5.   

    楼主对SQL语句不熟的话,可以直接到企业管理器选中表右键后 选 设计 来完成 主键的设定
      

  6.   

    Table 'student' already has a primary key defined on it.
    --说明这个表已经是有主键了撒