The BTEQ script for IMPORT function is not working

General
Enthusiast

The BTEQ script for IMPORT function is not working

Hi,

I have written the below BTEQ script, to import data from flatfile to Teradata Table. But it's not working. Can any one look into this ASAP and help me out from this given below error.
-------------------------------------------------------
.logon 10.14.139.124/suji,xxxx;
.IMPORT VARTEXT',' FILE=/home/flatfile.txt
.QUIET ON
.REPEAT *
USING
a VARCHAR(1),
b VARCHAR(10)
INSERT INTO db.table(a,b) values (:a,:b);
.LOGOFF
.QUIT
----------------------------------------------------------
My flatfile looks like below:

1 EXPALL0610
2 HLTHCP0610
3 TUAC0610
4 TULC0610
5 TUQU0610
---------------------------------------------------
The above bteq script is not working. It is showing the below error. Can any one please help.

.logon 10.14.139.124/suji,

*** Logon successfully completed.
*** Teradata Database Release is 12.00.03.04
*** Teradata Database Version is 12.00.03.06
*** Transaction Semantics are BTET.
*** Character Set Name is 'ASCII'.

*** Total elapsed time was 2 seconds.

+---------+---------+---------+---------+---------+---------+---------+----

.IMPORT VARTEXT',' FILE=/home/flatfile.txt
+---------+---------+---------+---------+---------+---------+---------+----
.QUIET ON
*** Type QUIET OFF; to resume output.
+---------+---------+---------+---------+---------+---------+---------+----
.REPEAT *
+---------+---------+---------+---------+---------+---------+---------+----
USING
a VARCHAR(1),
b VARCHAR(10)
INSERT INTO db.table(a,b) values (:a,:b);
*** Starting Row 0 at Wed Oct 27 08:22:07 2010

UPI VARCHAR(1),
$
*** Failure 3707 Syntax error, expected something like '(' between the word
'UPI' and the 'VARCHAR' keyword.
Statement# 1, Info =21
*** Total elapsed time was 1 second.

*** Warning: Repeat is cancelled.
*** Finished at input row 1 at Wed Oct 27 08:22:07 2010
*** Total number of statements: 1, Accepted : 0, Rejected : 1

*** Total elapsed time was 1 second.

+---------+---------+---------+---------+---------+---------+---------+----

.LOGOFF
*** You are now logged off from the DBC.
+---------+---------+---------+---------+---------+---------+---------+----

.QUIT
*** Exiting BTEQ...
*** RC (return code) = 8

Thanks.
1 REPLY
Enthusiast

Re: The BTEQ script for IMPORT function is not working

Hi ,

Change the layout portion in the above script with the one mentioned below.
USING
a (VARCHAR(1)),
b (VARCHAR(10))

and include delimiter , in the flat file

1,EXPALL0610
2,HLTHCP0610
3,TUAC0610
4,TULC0610
5,TUQU0610

Thanks
Sakthi