Need help in BTEQ(Import)

Tools
Enthusiast

Need help in BTEQ(Import)

Hi,

I am getting below error while inserting data into table
** 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.

I am importing data from below file:
cat /home/user/jj
xyz 1
abc 2

BTEQ Script as below:
.logon xyz/loginid,password
.IMPORT DATA FILE = /home/user/jj,SKIP = 2
.QUIET ON
.REPEAT *
USING NAME(VARCHAR(25)),
ID(INTEGER)
INSERT INTO DB.TABLE(NAME,ID)
VALUES(:NAME,:ID);
COMMIT;

.LOGOFF.
.QUIT

My table defination as:
CREATE SET TABLE DB.TABLE,NO FALLBACK ,
NO BEFORE JOURNAL,
NO AFTER JOURNAL,
CHECKSUM = DEFAULT
(
NAME VARCHAR(25) CHARACTER SET LATIN NOT CASESPECIFIC TITLE 'MANAGER_NAME' NOT NULL,
ID INTEGER)
PRIMARY INDEX ( ID );

Please help me out of this.

Thanks a lot.

Regards,
Ravi.

11 REPLIES

Re: Need help in BTEQ(Import)



Hi Ravi

What i understud is :

1.u mensioned name as varchar(25),after that space is present ur not considering this space.i feel use
.filler * char(1) as another field after name.and change varchar(25) into char(3)

correct me if i am wrong.i understud something like that.

regrads
Bharati
Teradata Employee

Re: Need help in BTEQ(Import)

Your input file is not in the proper format for IMPORT DATA. Looks like VARTEXT delimited by ' ' based on your post.

Note that when using VARTEXT the USING clause must describe each input field as VARCHAR; Teradata will translate to the proper column datatype.
Enthusiast

Re: Need help in BTEQ(Import)

Thanks for the reply...

I was wrong here only

in place of
USING NAME(VARCHAR(25)),ID(INTEGER)

we can take
USING NAME(VARCHAR(10)),ID(VARCHAR(10))

TD internally insert data as per data type of columns...

Enthusiast

Re: Need help in BTEQ(Import)

Hi,

Can we Import integer values in BTEQ, please help me how to import.

Senior Apprentice

Re: Need help in BTEQ(Import)

Of course you can import integers.

What's the format of the input file, binary or text?

For binary you should DEFINE the column as INT else [VAR]CHAR(11)

Dieter

Enthusiast

Re: Need help in BTEQ(Import)

My file is Employee.CSV

Senior Apprentice

Re: Need help in BTEQ(Import)

For CSV you should try VARCHAR(11) and set the delimiter to the appropriate char, default is '|'.

Dieter

Enthusiast

Re: Need help in BTEQ(Import)

Hi,

I have 1,40,000 rows in my CSV file and I need to import into Volatile table,

this is my code

Creating table:

Create Volatile table Employee_Report(F1 Varchar(10), F2 Varchar(10),F3 Varchar(10)) ON COMMIT PRESERVE ROWS

Importing data into table:

Import vartext ',' File=c:\Employee.CSV;

.REPEAT *;

USING F1 (Varchar(10)), F2 (Varchar(10)),F3 (Varchar(10))

INSERT INTO Employee_Report Values(:F1,:F2,:F3);

Issue:

There is no response in BTEQ screen for hours and i need to close BTEQ forcefully

Please guide me, is BTEQ handles large amount of data?

Senior Apprentice

Re: Need help in BTEQ(Import)

Could you show how the actual script, how you call it and the output?

Does it work when you do a "REPEAT 10"?

BTEQ is not really fast for a larger number of rows, but when you add a ".PACK 1000" this should be finished much faster.

Dieter