主题:在SQL2000中,外键引用主键请教
创建Students表,创建RollNo,StudentName为组合键,没有什么问题;
CourseCode为外键,引用Course表(Course表已创建,在这里省略)中的CourseCode主键,有错误发生,应该怎么修改啊?
CREATE TABLE Students(
RollNo int,
StudentName varchar(20) PRIMARY KEY(RollNo,StudentName),
EnrollmentDate datetime,
CourseCode int foreign key references Course(CourseCode),---这句有问题
Qualification varchar(20),
Address varchar(100),
EmailID varchar(20),
ContactNo bigint,
Opinion varchar(100),
Status varchar(20),
FeeOpted varchar(15),
NumberOfInstallments tinyint,
BatchNo int)
CourseCode为外键,引用Course表(Course表已创建,在这里省略)中的CourseCode主键,有错误发生,应该怎么修改啊?
CREATE TABLE Students(
RollNo int,
StudentName varchar(20) PRIMARY KEY(RollNo,StudentName),
EnrollmentDate datetime,
CourseCode int foreign key references Course(CourseCode),---这句有问题
Qualification varchar(20),
Address varchar(100),
EmailID varchar(20),
ContactNo bigint,
Opinion varchar(100),
Status varchar(20),
FeeOpted varchar(15),
NumberOfInstallments tinyint,
BatchNo int)