Seek clarification for Reserved words

Database
Enthusiast

Seek clarification for Reserved words

For Teradata 12 - SQL Reference_Fundamentals.pdf , Appendix B contains a list of Restricted Words,Reserved Words and Keywords.
Per my knowledge - Teradata database has reserved words that cannot be used in SQL queries

I found below keywords(TERADATA_RESERVED) are matching with existing table-names or column-names.

PATH
NULLABLE
SCALE
ROW_COUNT
SEQUENCE
TABLE_NAME
FLOOR
NAME
SEARCH
C
HIERARCHY
NUMBER
OUTPUT
SQLTEXT
ROWID

But i was able to run queries containing these KEYWORDS (except for SQLTEXT and ROWID ,which throw error)
For eg:
SELECT NAME FROM DATABASENAME.TABLENAME
SELECT HIERARCHY FROM DATABASENAME.TABLENAME
SELECT SEARCH FROM DATABASENAME.TABLENAME

On copy/pasting them on SQL Assistant only SQLTEXT and ROWID changed to BLUE color (highlighting as a keyword)

I need clarity - why only SQLTEXT and ROWID were errored out and remaining KEYWORDS ran through despite all of them being TERADATA RESERVED KEYWORDS for TD 12.
Are there different parameters on their usage?

5 REPLIES
Enthusiast

Re: Seek clarification for Reserved words

Could you please Paste the sql which threw error i.e. for SQLTEXT and ROWID.
Have you tried using "SQLTEXT" or "ROWID" (Using the inverted Commas in you SQL)

Regards

Re: Seek clarification for Reserved words

i am not getting errors while working on it.
Enthusiast

Re: Seek clarification for Reserved words

Yes , when i said that iam not getting error with SQLTEXT and ROWID, the sql for them was:

SELECT "SQLTEXT" FROM DATABASENAME.TABLENAME;
SELECT "ROWID" FROM DATABASENAME.TABLENAME;

but using them plainly as:

SELECT SQLTEXT FROM DATABASENAME.TABLENAME;
SELECT ROWID FROM DATABASENAME.TABLENAME;

is resulting in sysntax error.

Iam curious to know ,why the other KEYWORDS are not throwing errors despite them being RESERVED like, SQLTEXT and ROWID.
Below queries are running fine in our environment!!

SELECT NAME FROM DATABASENAME.TABLENAME;
SELECT HIERARCHY FROM DATABASENAME.TABLENAME;
SELECT SEARCH FROM DATABASENAME.TABLENAME ;

Any leads here...???
Enthusiast

Re: Seek clarification for Reserved words

Karam,

At least some of the words you cited as reserved are not classified as reserved. They are classified as "nonreserved keywords" by Teradata and/or the ANSI/ISO SQL standard, which means that they are available to be used as identifiers.
Enthusiast

Re: Seek clarification for Reserved words

Thanks for the response Jim...
After your catch, i too revisited the pdf only to observe that all the other KEYWORDS mentioned above apart from SQLTEXT and ROWID are indeed NON-RESERVED KEYWORDS meaning they are permitted as an identifier but discouraged because of possible confusion that may result.
But important observation is - they are allowed to be used as identifier..
Hence the reason , why they are running good in our environment.
Again... thanks for the clarification..