Teradata - How to Define If Session in Teradata or ANSI Mode

You can use a SQL query, SQL or BTEQ statement to find out the current mode: Teradata or ANSI.

SQL Query

You can query transaction_mode column of dbc.sessioninfo to get the current mode for the specified session. A is returned if the mode is ANSI, and T if the mode is Teradata.

For the current session:

   SELECT transaction_mode FROM dbc.sessioninfo
   WHERE sessionno = SESSION;
   -- Result: T

SQL Statement

You can use the Teradata SQL statement HELP SESSION to get the current mode:

   HELP SESSION;

Among other columns it returns Transaction Semantics column that contains values ANSI or Teradata:

User Name Logon Date Transaction Semantics
DBC 12/02/24 Teradata

BTEQ Statement

You can use the Teradata BTEQ statement .SHOW CONTROL (or .SHOW CONTROLS) to get the current mode:

   .SHOW CONTROL

Among other rows, it returns SESSION TRANSACTION that contains BTET for Teradata mode, and ANSI.

Default Maximum Byte Count = 1048500
Default Multiple Maximum Byte Count = 2048
Current Response Byte Count = 65473
[SET] SESSION TRANSACTION = BTET

Teradata Resources