The Teradata RDBMS (Relational DataBase Management System) has incorporated into it functions that provide data regarding a user who has performed a logon connection to the system. The following functions make that data available to a user.

ACCOUNT Function

A user within the Teradata database has an account number. This number is used to identify the user, provide a basis for chargeback, if desired and establish a basic priority.

Previously, this number was used exclusively by the database administrator to control and monitor access to the system. Now, it is available for viewing by the user via SQL.

Syntax for using the ACCOUNT function:

SEL[ECT] ACCOUNT ;

As an example, the following returns the account information for my user:

SELECT ACCOUNT; 1 Row returned

ACCOUNT

$M13678 If your account starts with a$M, you are running at a medium priority. Where $L is low and$H is high. At the same time, the account does not have to begin with one of these and can be any site specific value.

DATABASE Function

Knowing the current database within Teradata is sometimes an important piece of information needed by a user. As mentioned above, the HELP SESSION is one way to determine it. However, a lot of other information is also presented. Sometimes it is advantageous to have only that single tidbit of data not only to see but also for storage. When this is the case, the DATABASE function is available.

Syntax for using the DATABASE function:

SEL[ECT] DATABASE ;

As an example, the following returns the account information for my user:

SELECT DATABASE; 1 Row returned

DATABASE

Mikel

SESSION Function

The HELP SESSION provides a wealth of information regarding the individual session established for a user. One of those pieces of data is the session number. It uniquely identifies every user session in existence at any point in time. Teradata now makes the session number available using SQL.

Syntax for using the DATABASE function:

SEL[ECT] SESSION ;

As an example, the following returns the account information for my user:

SELECT SESSION; 1 Row returned

SESSION

1059