create table student(  Sno char(5) not null primary key,
                       Sname char(20) not null,
                       Ssex char(2) ,
                       Sage int ,
                       Sdept char(20)
)
create table SC ( 

                  Cno int not null, <<<====你这里类型都不一样呀!!是char吧!
                  Grade int not null,
Sno char(5) not null
/*CONSTRINT [FK_DEPTNO]
FOREIGN KEY(Sno)*/
REFERENCES student(Sno)
on delete CASCADE
on update cascade,
)

解决方案 »

  1.   

    insert into SC values('95001',1,92)错误values和列没有对应
      

  2.   

    insert into student values ('95001','李勇','男',20,'CS');
    goinsert into SC values('95001',1,92);
    go
    分两次提交.
      

  3.   

    create table SC ( 

                      Cno int not null,
                      Grade int not null,
    Sno char(5) not null
    /*CONSTRINT [FK_DEPTNO]
    FOREIGN KEY(Sno)*/
    REFERENCES student(Sno)
    on delete CASCADE
    on update cascade,
    )最后有误
    多了一个逗号
      

  4.   

    首先,两个insert语句间要加go做为两个batch进行提交,因为有引用的约束
    其次,Cno int not null的类型定义与插入的值不相符
      

  5.   

    谢谢各位相助,原来是把VALUES 和列对应错了.