SQLite语法错误

时间:2012-04-19 14:20:24

标签: sql sqlite

您好我的数据库中有一个表有问题。当我加载数据库时,我正在从.txt文件加载表

ERROR NEAR line 49: near "(": syntax error

下表从第49行开始

create table LEASE(
P_ID integer,
I_ID varchar2,
C_ID integer,
DATE date,
TRENT decimal(6,2),
RENTPM decimal(4,2),
RENTUTD varchar2 constraint rentutd_value (RENTUTD in ('Y','N')),
LENGTH varchar2(15),
SDATE date,
EDATE date,
NOTE varchar2(150),
G_ID integer,
A_ID integer,
constraint fkey_lea1 foreign key (P_ID) references PROPERTY(P_ID),
constraint fkey_lea2 foreign key (I_ID) references INSTITUTION(I_ID),
constraint fkey_lea3 foreign key (C_ID) references CLIENT(C_ID),
constraint fkey_lea4 foreign key (G_ID) references GUARANTOR(G_ID),
constraint fkey_lea5 foreign key (A_ID) references AGENT(A_ID),
constraint pkey_lea primary key (P_ID,I_ID,C_ID,DATE)
);

1 个答案:

答案 0 :(得分:1)

您的rentutd列上的语法看起来有点不同:

RENTUTD varchar2 constraint rentutd_value CHECK ( RENTUTD in ('Y','N'))

请参阅此sqlfiddle

SQLite syntax diagrams很好地解决了这个问题。