Teradata BTEQ – Part 3



Teradata BTEQ import sample script

/*Section 1*/
.logon 192.168.106.2/teradatapoint,teradatapoint;

/*Section 2*/
CREATE SET TABLE teradatapoint.employee ,NOFALLBACK ,
NO BEFORE JOURNAL,
NO AFTER JOURNAL,
CHECKSUM=DEFAULT,
DEFAULT MERGEBLOCKRATIO
     (
emp_IDINTEGER,
emp_nameVARCHAR(10) CHARACTER SET LATIN NOT CASESPECIFIC,
mgr_IDINTEGER)
PRIMARY INDEX( emp_ID );


.IMPORT DATA FILE=C:\teradatapoint\import_data.txt;

/*Section 3*/
.QUIET ON
.REPEAT *

/*Section 4*/
USING emp_ID (INTEGER),
emp_name (VARCHAR(10)),
mgr_ID (INTEGER)

INSERT INTO teradatapoint.employee
    (emp_ID,
emp_name,
mgr_ID)
VALUES    (:emp_ID,
:emp_name,
:mgr_ID);

/*Section 5*/
.LOGOFF
.EXIT

 

Section 1- In this section, We need to provide logon information like tdpid or ip_address of Teradata system, username, password.

Section 2- We need to provide source filename and structure of the data in it.

Section 3- Quiet on limits the output to reporting onlyerrors and processing statistics. .REPEAT * causes BTEQ to read the records till the end of the file.

Section 4- The USING Specifies the parameters of the inputfile.

Section 5- BTEQ logs off from the Teradata system.