我的一段建表代码如下:
---创建学生信息表
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[student]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[student]
GO
create table [dbo].[student](
[学号] [varchar] (10) not null,
[姓名] [varchar] (10) COLLATE Chinese_PRC_CI_AS NOT NULL,
[性别] [char] (2 ) not null,
[所在班级号] [varchar] (10) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[入学年份] [datetime] not null,
[身份证号] [varchar] (20) not null,unique,
[出生日期] [datetime] not null,
[民族] [char] not null,
[籍贯] [varchar] not null,
[地址] [text] COLLATE Chinese_PRC_CI_AS NOT NULL,
[电话] [varchar] (20) null,
[相片] [binary] null,
[备注] [text] null
constraint [PK_student] primary key clustered
( [学号]
)on [primary],
constraint [FK_student_class] foreign key
( [所在班级号]
) references [class]
(
[班级编号]
)
) on [primary]
go
但运行时出错:服务器: 消息 8135,级别 16,状态 1,行 1
表级别的约束未指定列的列表,表 'dbo.student'。
该怎么改呢?