Home » excel » How to import data into teradata tables from an excel file using BTEQ import?

How to import data into teradata tables from an excel file using BTEQ import?

Posted by: admin May 14, 2020 Leave a comment

Questions:

Im trying to import data into tables from a file using BTEQ import.

im facing weird errors while doing this

Like:

if im using text file as input data file with ‘,’ as delimiter as filed seperator im getting the error as below:

*** Failure 2673 The source parcel length does not match data that was defined.

or

if im using EXCEL file as input data file im getting the error as below:

* Growing Buffer to 53200
*
Error: Import data size does not agree with byte length.
The cause may be:
1) IMPORT DATA vs. IMPORT REPORT
2) incorrect incoming data
3) import file has reached end-of-file.
*** Warning: Out of data.

please help me out by giving the syntax for BTEQ import using txt file as input data file and also the syntax if we use EXCEL file as the input data file

Also is there any specific format for the input data file for correct reading of data from it.
if so please give me the info about that.

Thanks in advance:)

EDIT

sorry for not posting the script in first.
Im new to teradata and yet to explore other tools.
I was asked to write the script for BTEQ import

.LOGON TDPD/XXXXXXX,XXXXXX
.import VARTEXT ‘,’ FILE = D:\cc\PDATA.TXT
.QUIET ON
.REPEAT *
USING
COL1 (VARCHAR(2))
,COL2 (VARCHAR(1))
,COL3 (VARCHAR(56))

INSERT INTO
( COL1
,COL2
,COL3)
VALUES ( :COL1
,:COL2
,:COL3);
.QUIT

I executed the above script and it is successful using a txt(seperating the fileds with comma) file and giving the datatype as varchar.

sample input txt file:
1,b,helloworld1
2,b,helloworld2
3,D,helloworld1
12,b,helloworld1

I also tried to do the same using tab(\t) as the field seperator but it giving the same old error.
Q) Does this work only for comma seperated txt files?

Please could u tell me where can i find the BTEQ manual…

Thanks a lot

How to&Answers:

Can you post your BTEQ script? May I also ask why you are using BTEQ instead of FastLoad or MultiLoad?

The text file error is possibly due to the data types declared in the using clause. I believe they need to be declared as VARCHAR when reading delimited input (eg. declare as VARCHAR(10) for INTEGER fields).

As for Excel, I can’t find anything in the BTEQ manual that says that BTEQ can handle .xls files.


For your tab delimited files, are you doing this (that’s a tab character below)?

.import vartext '   '

Or this?

.import vartext '\t'

The former works, the latter doesn’t.

The BTEQ manual that I have is on my work machine. One of the first Google results for “BTEQ manual” should yield one online.