Problem in importing data from text file to teradata database using bteq

Tools
N/A

Problem in importing data from text file to teradata database using bteq

When i export the data from a table to any text file using bteq
then data is written correctly in text file.
But when i again import the same data from text file (skipping the title line) to same table,
data is inserted successfully but some garbage value instead of the actual data.
I am using normal select and Insert command for a single data only.

please anyone suggest me the solution?

thanx in advance

Regards,
Kunal

6 REPLIES

Re: Problem in importing data from text file to teradata database using bteq

can you share your scripts, table structure, sample data etc...

May be it's just a data conversion issue.
N/A

Re: Problem in importing data from text file to teradata database using bteq

i am using just a simple table:

create table EMP(
empid integer
);

exporting the data from table using this :

.export report FILE='c:\......\bteqfile.txt'
select empno from USER1.EMp;
.export reset

and again inserting the data(by first making table empty) using this

.iMPORT REPORT FILE='c:\......\bteqfile.txt', SKIP=2
using (empno integer)
insert into USER1.EMP(empno)
values (:empno);

waiting for your reply

thanks and regards,
Kunal
Teradata Employee

Re: Problem in importing data from text file to teradata database using bteq

The USING phrase must describe the input data, not the table. You used REPORT format for your export, so that data is CHAR not INTEGER. If you are using the default INTEGER format '-(10)9', then your USING needs to say CHAR(11).
N/A

Re: Problem in importing data from text file to teradata database using bteq

thanx its now working
but why length of the char is 11

Re: Problem in importing data from text file to teradata database using bteq

CHAR(11) is one byte for the sign byte.
N/A

Re: Problem in importing data from text file to teradata database using bteq

Wow !!! its working for me too... thanks to Fred King...