大家看我的SQL语句,ACCESS中提示constraint子句错误,然后指到CHECK?????
CREATE TABLE Course (Cno CHAR(4) PRIMARY KEY, Cname CHAR(20) NOT NULL,Ccredit int,Period int,constraint Ccredit_name CHECK(Ccredit> 0),constraint Period_name CHECK(Periok> 0))
要求Cno为主键,Ccredit和Period 字段值要大于0,
我的SQL语句错哪里啦
------解决方案--------------------Dim Cnn As New ADODB.Connection
ff = "CREATE TABLE Course (Cno CHAR(4) PRIMARY KEY, Cname CHAR(20) NOT NULL,Ccredit int,Period int,constraint Ccredit_name CHECK(Ccredit> 0),constraint Period_name CHECK(Period> 0)) "
Cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\zz\db2.MDB;Persist Security Info=False "
Cnn.Execute (ff)