LIBNAME Statement for the Teradata Engine

Overview

This section describes the LIBNAME statement that SAS/ACCESS Interface to Teradata supports. For general information about this feature, see LIBNAME Statement for Relational Databases.

Here is the LIBNAME statement syntax for accessing Teradata.

LIBNAME libref teradata <connection-options> <LIBNAME-options>;

For general information about the LIBNAME statement that is not specific to SAS/ACCESS, see LIBNAME Statement in SAS Global Statements: Reference.

Arguments

libref

specifies any SAS name that serves as an alias to associate SAS with a database, schema, server, or group of tables and views.

teradata

specifies the SAS/ACCESS engine name for the Teradata interface.

connection-options

provides connection information and controls how SAS manages the timing and concurrence of the connection to the DBMS. Here are the connection options for the Teradata interface.

Note: All of these connection options, except SCHEMA=, are valid when used in the CONNECT statement with the SQL procedure.
USER=<'>Teradata-user-name<'> | <">ldapid@LDAP<"> | <">ldapid@LDAPrealm-name<">

specifies a required connection option that specifies a Teradata user name. If the name contains blanks or national characters, enclose it in quotation marks.

For more information about LDAP, see Authentication Using LDAP.

PASSWORD=<'>Teradata-password<'>

is a required connection option that specifies a Teradata password. The password that you specify must be correct for your USER= value. If the password contains spaces or nonalphanumeric characters, you must enclose it in quotation marks. If you do not want to enter your Teradata password in clear text on this statement, see PROC PWENCODE in the Base SAS Procedures Guide for a method for encoding it. For LDAP authentication, use this password option to specify the authentication string or password.

ACCOUNT=<'>account_ID<'>

is an optional connection option that specifies the account number that you want to charge for the Teradata session.

TDPID=<'>dbcname<'>

Alias: SERVER=

specifies a required connection option if you run more than one Teradata server. TDPID= operates differently for network-attached and channel-attached systems, as described below.

  • For NETWORK-ATTACHED systems (PC and UNIX), dbcname specifies an entry in your (client) HOSTS file or a name that is resolved by Domain Name Services (DNS) that provides an IP address for a database server connection.

    By default, SAS/ACCESS connects to the Teradata server that corresponds to the dbccop1 entry in your HOSTS file. When you run only one Teradata server and your HOSTS file specifies the dbccop1 entry correctly, you do not need to specify TDPID=.

    However, if you run more than one Teradata server, you must use the TDPID= option to specify a dbcname that resolves to the network address of the database server. SAS/ACCESS adds the specified dbcname to the logon string that it submits to Teradata. (Teradata documentation refers to this name as the tdpid component of the logon string.)

    After SAS/ACCESS submits a dbcname to Teradata, Teradata searches your HOSTS file for all entries that begin with the same dbcname. For Teradata to recognize the HOSTS file entry, the dbcname suffix must be COPx (x is a number). If there is only one entry that matches the dbcname, x must be 1. If there are multiple entries for the dbcname, x must begin with 1 and increment sequentially for each related entry. (See the example HOSTS file entries below.)

    When there are multiple, matching entries for a dbcname in your HOSTS file, Teradata does simple load balancing by selecting one of the Teradata servers that are specified for logon. Teradata distributes your queries across these servers so that it can return your results as fast as possible.

    The TDPID= examples below assume that your HOSTS file contains these dbcname entries and IP addresses.

    • Example 1: The TDPID= option is not specified, establishing a logon to the Teradata server that runs at 10.25.20.34: dbccop1 10.25.20.34
    • Example 2: Using TDPID= myserver or SERVER=myserver, you specify a logon to the Teradata server that runs at 130.96.8.207: myservercop1 130.96.8.207
    • Example 3: Using TDPID=xyz or SERVER=xyz, you specify a logon to a Teradata server that runs at 11.22.33.44 or to a Teradata server that runs at 33.44.55.66: xyzcop1 33.44.55.66 or xyzcop2 11.22.33.44

    To support data parcels that are longer than 64K, the Teradata interface queries the Teradata database to assess Alternate Parcel Header (APH) extended-parcel sizes. In such cases, it needs the Teradata server name (dbcname) as an entry in the HOSTS file or NAMES database to successfully configure the Teradata client for APH processing. The value of the SERVER= (TDPID=) LIBNAME option must be the unqualified short name, not the fully qualified IP name (for example, SERVER=foo rather than SERVER=foo.my.unx.com).

  • For CHANNEL-ATTACHED systems (z/OS), TDPID= specifies the subsystem name. This name must be TDPx, where x can be 0–9, A–Z (not case sensitive), or $, # or @. If there is only one Teradata server, and your z/OS system administrator has set up the HSISPB and HSHSPB modules, you do not need to specify TDPID=. For more information, see your Teradata TDPID documentation for z/OS.
DATABASE=<'>database-name<'>

Alias: DB=

specifies an optional connection option that establishes a LIBNAME connection to the specified DATABASE= name. The database name that you specify becomes the default database. This option enables the user to directly access another database as the user’s default database, eliminating the need to qualify database objects. The user is actually logged in to the specified database. You must first set permissions to allow user access. If you do not specify DATABASE= in the LIBNAME statement, then the user’s default database is used. This usually is a database with the same name as the user name.

SCHEMA=<'>database-name<'>

specifies an optional value that you can use to fully qualify objects in another database for SQL processing. Using the SCHEMA= option does not establish a physical connection to the specified schema.

LIBNAME options

specify how SAS processes DBMS objects. Some LIBNAME options can enhance performance, and others determine locking or naming behavior. The following table describes the LIBNAME options for SAS/ACCESS Interface to Teradata, with the applicable default values. This table also identifies LIBNAME options that are valid in the CONNECT statement in the SQL procedure. For more information, see LIBNAME Options for Relational Databases.

SAS/ACCESS LIBNAME Options for Teradata

Option

Default Value

Valid in CONNECT

ACCESS=

none

AUTHDOMAIN=

none

BULKLOAD=

NO

CAST=

none

CAST_OVERHEAD_MAXPERCENT=

20%

CONNECTION=

UNIQUE for network attached systems (UNIX and PC platforms)

SHAREDREAD for channel-attached systems (z/OS)

CONNECTION_GROUP=

none

DBCLIENT_MAX_BYTES=

1

DBCOMMIT=

1000 (when inserting rows), 0 (when updating rows)

DBCONINIT=

none

DBCONTERM=

none

DBCREATE_TABLE_OPTS=

none

DBGEN_NAME=

DBMS

DBINDEX=

NO

DBLIBINIT=

none

DBLIBTERM=

none

DBMSTEMP=

NO

DBPROMPT=

NO

DBSASLABEL=

COMPAT

DBSLICEPARM=

none (no default value)

DEFER=

NO

DIRECT_EXE=

DIRECT_SQL=

YES

ERRLIMIT=

none

FASTEXPORT=

NO

LOGDB=

Default Teradata database for the libref

MODE=

ANSI

MULTISTMT=

NO

MULTI_DATASRC_OPT=

IN_CLAUSE

OVERRIDE_RESP_LEN=

NO

POST_STMT_OPTS=

none

PRESERVE_COL_NAMES=

YES

PRESERVE_TAB_NAMES=

YES

QUERY_BAND=

none

READ_ISOLATION_LEVEL=

see Locking in the Teradata Interface

READ_LOCK_TYPE=

none

READ_MODE_WAIT=

none

REREAD_EXPOSURE=

NO

SAS_DBMS_AUTOMETADATA=

NO

SCHEMA=

none

SESSIONS=

none

SLEEP=

6

SPOOL=

YES

SQL_FUNCTIONS=

none

SQL_FUNCTIONS_COPY=

none

SQLGENERATION=

none

TEMPORAL_QUALIFIER=

CURRENT VALIDTIME for valid-time column; CURRENT TRANSACTIONTIME for transaction-time column

TENACITY=

0 for FastLoad; 4 for FastExport and MultiLoad

TPT=

YES

TPT_DATA_ENCRYPTION=

NO

TPT_MAX_SESSIONS=

4

TPT_MIN_SESSIONS=

1

TPT_UNICODE_PASSTHRU=

NO

TR_ENABLE_INTERRUPT=

NO

UPDATE_ISOLATION_LEVEL=

see Locking in the Teradata Interface

UPDATE_LOCK_TYPE=

none

UPDATE_MODE_WAIT=

none

UTILCONN_TRANSIENT=

NO

Last updated: February 3, 2026