BTEQ - Run file (Batch mode) in Teradata

You can run batch of commands in BTEQ using the batch mode utility.
All necessary commands (both BTEQ and SQL) will be put in a file and the file will be supplied as input to BTEQ using RUN FILE command.

.RUN FILE = <path of the file>


Consider the content below present in a file C:\tx\sample.txt
.LOGON localtd/dbc,dbc
.EXPORT report  file=C:\tx\s1.xls;
DATABASE forgetcode;
SELECT * FROM tbl_employee;
.EXPORT reset

In BTEQ, you can simply give the command as
.RUN FILE = C:\tx\sample.txt;

Each statement of the file will be executed and the output of select will be written to the file C:\tx\s1.xls