All Forums Database
matty.jiang 4 posts Joined 03/06
23 Mar 2006
why does sql cannot pass systax?

CREATE MULTISET TABLE ODS_TIME ( DATE_ID DATE NOT NULL, DAY_OF_WEEK VARCHAR(20) CHARACTER SET LATIN NOT CASESPECIFIC, MONTH VARCHAR(20) CHARACTER SET LATIN NOT CASESPECIFIC, QUARTER VARCHAR(20) CHARACTER SET LATIN NOT CASESPECIFIC, YEAR CHAR(4) CHARACTER SET LATIN NOT CASESPECIFIC); PRIMARY INDEX ( DATE_ID );SQL ASSISTANT reports an error like:Code = 3707.Statement 1 - 3707: Syntax error, expected something like a 'CHECK' keyword between 'DAY_OF_WEEK' and the 'MONTH' keyword.

23 Mar 2006

MONTH and YEAR are KEY WORDS you cannot use them as a field name or table name.There are many such KEY WORDS that you cannot use as table or column names.change the name to MONTH_NUM, or MONTH_VAL etc ... it should workCREATE MULTISET TABLE ODS_TIME(DATE_ID DATE NOT NULL,DAY_OF_WEEK VARCHAR(20) CHARACTER SET LATIN NOT CASESPECIFIC,MONTH_NUM VARCHAR(20) CHARACTER SET LATIN NOT CASESPECIFIC,QUARTER VARCHAR(20) CHARACTER SET LATIN NOT CASESPECIFIC,YEAR_NUM CHAR(4) CHARACTER SET LATIN NOT CASESPECIFIC);PRIMARY INDEX ( DATE_ID );

Fred 1096 posts Joined 08/04
23 Mar 2006

Or use quotes to force the p****r to treat the token as an identifier rather than a keyword: "MONTH", "YEAR", etc.

matty.jiang 4 posts Joined 03/06
23 Mar 2006

thanks a lot!

You must sign in to leave a comment.