why does sql cannot pass systax?

Database

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.
3 REPLIES
Enthusiast

Re: why does sql cannot pass systax?

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 work

CREATE 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 );
Teradata Employee

Re: why does sql cannot pass systax?

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

Re: why does sql cannot pass systax?

thanks a lot!