Naming Conventions for Teradata

Teradata Conventions

For general information about this feature, see SAS Names and Support for DBMS Names.
You can use these conventions to name such Teradata objects as include tables, views, columns, indexes, and macros.
  • A name must be from 1 to 30 characters long.
  • A name must begin with a letter unless you enclose it in double quotation marks.
  • A name can contain letters (A to Z), numbers from 0 to 9, underscore (_), dollar sign ($), and the number or pound sign (#). A name in double quotation marks can contain any characters except double quotation marks.
  • A name, even when enclosed in double quotation marks, is not case sensitive. For example, CUSTOMER and Customer are the same.
  • A name cannot be a Teradata reserved word.
  • Because the name must be unique between objects, a view and table in the same database cannot have an identical name.

SAS Naming Conventions

Use these conventions when naming a SAS object:
  • A name must be from 1 to 32 characters long.
  • A name must begin with a letter (A to Z) or an underscore (_).
  • A name can contain letters (A to Z), numbers from 0 to 9, and an underscore (_).
  • Names are not case sensitive. For example, CUSTOMER and Customer are the same.
  • A name cannot be enclosed in double quotation marks.
  • A name need not be unique between object types.

Naming Objects to Meet Teradata and SAS Conventions

To easily share objects between SAS and the DBMS, create names that meet both SAS and Teradata naming conventions:
  • Start with a letter.
  • Include only letters, digits, and underscores.
  • Use a length of 1 to 30 characters.

Accessing Teradata Objects That Do Not Meet SAS Naming Conventions

Overview

The following SAS/ACCESS code examples can help you access Teradata objects (existing Teradata DBMS tables and columns) that have names that do not follow SAS naming conventions.

Example 1: Unusual Teradata Table Name

libname unusual teradata user=testuser password=testpass;
proc sql dquote=ansi;
  create view myview as
  select * from unusual."More names";
proc print data=myview;run;

Example 2: Unusual Teradata Column Names

SAS/ACCESS automatically converts Teradata column names that are not valid for SAS, mapping such characters to underscores. It also appends numeric suffixes to identical names to ensure that column names are unique.
create table unusual_names( Name$ char(20), Name# char(20),
                             "Other strange name" char(20))
 
In this example SAS/ACCESS converts the spaces found in the Teradata column name, OTHER STRANGE NAME, to Other_strange_name. After the automatic conversion, SAS programs can then reference the table as usual.
libname unusual teradata user=testuser password=testpass;
proc print data=unusual.unusual_names; run;
PROC PRINT Display
        Name_          Name_0        Other_strange_name