Teradata BTEQ stands for Basic Teradata Query. It is a command-driven utility that enables users to interact with one or more Teradata Database Systems.
BTEQ utility is used in both batch and interactive mode. It can be used to run any DML statement, DDL statement, create Macros, and stored procedures. BTEQ can be used to import data into Teradata tables from a flat file, and it can also be used to extract data from tables into files or reports.
Below are some terms that commonly used in BTEQ scripts.
Teradata BTEQ has the following limitations, such as:
BTEQ can import the data from the source and incorporate it into SQL to modify the content of one or more tables.
Syntax of the IMPORT command:
The data can be written to either mainframe or LAN attached computer using SELECT from Teradata. Data can be exported in a variety of formats such as:
Following is an example of the Teradata BTEQ script.
The above Teradata BTEQ script performs the above task in the following steps.
Step 1: Logs into Teradata System.
Step 2: Sets the Default Database.
Step 3: Creates a table called emp_bkup.
Step 4: Selects one record from the Emp table to check if the table has any records.
Step 5: Drops emp_bkup table if the table is empty.
Step 6: Transfers the control to a Label InsertEmp, which inserts records into the emp_bkup table.
Step 7: Then, check ERRORCODE to ensure that the statement is successful, following each SQL statement.
Step 8: ACTIVITYCOUNT returns the number of records selected/impacted by the previous SQL query.