Restricted Words In Teradata

Share via:
Restricted Words In Teradata

Dear Readers,

In this article you will get to know the  Restricted Words in Teradata.

What are restricted words ?

Teradata Database and ANSI/ISO SQL standards restrict the use of certain words as identifiers because thosewords may be incorrectly interpreted as SQL keywords. Restricted words should not be used as databaseobject names or as parameters in application programs that interface with the database.There are three categories of restricted words :

  • Reserved words
  • Future reserved words
  • Nonreserved words

Note:Teradata Parallel Transporter (Teradata PT) has a different set of restricted words.

You can use the SQL Restricted Words view and SQL Restricted Words_TBF function to see or query the restricted words in the current or previous releases of Teradata Database.

What are Reserved Words in Teradata?

These words are used as keywords by Teradata Database or ANSI/ISO SQL. They cannot be used as identifiers to name database objects, such as databases, tables, columns, or stored procedures.They also must not be used as macro or stored procedure parameters or local variables, host variables, or correlation names. Reserved words can be reserved by Teradata Database, by the ANSI/ISOSQL standard, or by both.

What are Future reserved words ?

These words are likely to be used as TeradataDatabase, keywords in the future. Like reserved words, future reserved words cannot be used as identifiers.

What are Nonreserved words ?

These words may become keywords in the future.Teradata does not recommend using Teradata Database non reserved words as identifiers if these words are reserved words in the ANSI standard.These words may become Teradata Database reserved words in the future.

How to get restricted words for the current Teradata database release ?

The below query can be used to get the list of restricted words for the current Teradata Database release. It includes the Teradata and ANSI categories for the words.

BTEQ — Enter your SQL request or BTEQ command:

BTEQ — Enter your SQL request or BTEQ command:

/* For SQL reserved word */

/* For TPT reserved word */

Is it recommended to resolve the conflicts with the reserved words?

YES, Teradata Database reserved words cannot be used as identifiers to name host variables, correlations, local variables in stored procedures, objects (such as databases, tables,
columns, or stored procedures), or parameters, such as macro or stored procedure parameters, because Teradata Database already uses the word and might misinterpret it.

Do we have to address all words reported in reserved words.rpt and reserved words tpt.rpt?

No. You need to address it if “STATUS” column says RESERVED, RESERVED/ANSI or RESERVED/TD in the files.Also, reserved words_tpt.rpt reports reserved word for TPT application. So, you can ignore it if you don’t use TPT.

Do we need to change reserved word before upgrade / migration?Will a table be unusable after upgrade/migration if it uses reserved word in object or column name?

You can upgrade/migrate without changing reserved words. The table will not be corrupted even if you don’t change reserved word.But after upgrade/migration, you need to double-quote reserved word in any queries.

Don’t we need to add double-quotation in a reserved word once we add it in DDL?

You still need to add double-quotation in any queries even if you added it in DDL.

What is reserved is “word itself”, not your individual object/column name.

Example :  ABORT is a reserved word.  Since this “word” is reserved itself, you need to add double-quotation when you use the word in any DDL/DML/DCL …

Reserved words examples with its effects and how to overcome the errors.

BTEQ — Enter your SQL request or BTEQ command:

BTEQ — Enter your SQL request or BTEQ command:

BTEQ — Enter your SQL request or BTEQ command:

BTEQ — Enter your SQL request or BTEQ command:

BTEQ — Enter your SQL request or BTEQ command:

BTEQ — Enter your SQL request or BTEQ command:

Reserved words as column names

BTEQ — Enter your SQL request or BTEQ command:

BTEQ — Enter your SQL request or BTEQ command:

BTEQ — Enter your SQL request or BTEQ command:

BTEQ — Enter your SQL request or BTEQ command:

In short, the reserved words should be put in double quotes whether it’s while creating it as a tablename or specifying as a  column-name or used in SELECT SQL

to retrieve data for that column

 

Thank you for giving your valuable time to read the above information.
Follow us on 
Website  www.ktexperts.com
Facebook Page KTExperts Facebook
Linkedin Page : KT EXPERTS Linkedin

Share via:
Note: Please test scripts in Non Prod before trying in Production.
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Add Comment