sql sever 设置联合主键
求大家看看哪里有问题
use School
GO
create table RESULT
(
CourseNo char(7) not null,
StudentuNo char(8) not null,
Primary key (CourseNo,StudentNo)
)
消息 102,级别 15,状态 1,第 4 行
',' 附近有语法错误。
字段名称不一致(字段StudentuNo 与主键列 StudentNo)
正确:
create table RESULT
(
CourseNo char(7) not null,
StudentNo char(8) not null,
Primary key (CourseNo,StudentNo)
)
你的studentNo写错了,两个名字写的不一致, 下面的是正确的写法
use School
GO
create table RESULT
(
CourseNo char(7) not null,
StudentNo char(8) not null,
Primary key (CourseNo, StudentNo)
)