BTEQ is a powerful utility in Teradata for various reasons. You can write the data of a table into a file using the BTEQ export utility. You can also use BTEQ for executing conditional statements based on certain logic, BTEQ can also be used for executing all kind of DML statements.
In this post, we will see how to export a table to file in BTEQ without a header.
LOGON teradataserver/userid,password .EXPORT DATA file = <output_path of file> .SET RECORDMODE OFF; .SET TITLEDASHES OFF; .SET SEPARATOR '|'; SELECT NAME,CITY,COUNTRY FROM CUSTDB.CUSTOMER where name='techieshouts'; .EXPORT reset; .IF ERRORCODE > 0 THEN .EXIT 1; .IF ACTIVITYCOUNT = 0 then .EXIT 2; .EXIT 0
Let us see the above script in detail
LOGON teradataserver/userid,password – This is to log into the Teradata server
.SET RECORDMODE OFF – This will suppress the column headers in the output file
.SET TITLEDASHES OFF – This will prevent the utility from printing the ‘—‘ (dashes) that will come after the column headers.
.SET SEPARATOR ‘|’ – This will create the output as ‘|’ delimited file.