Help Needed on bteq export/import option

Tools & Utilities
Enthusiast

Help Needed on bteq export/import option

Hi,

I am using the bteq import export option,I have followed the following steps in order:

Step 1
------
export data from table to file

.set width 900
.export data file=myoutput.txt
Select item_id from
db.tab1
sample 10;

.export rest;

Step 2
------
creating a new table

create table db.tab2
(item_id integer)
;

Step 3
-------
import data from file to table

.import data file=myoutput.txt,skip=3
.quiet on
.repeat *
using item_id(integer)
insert into db.tab2
(item_id
)
values
(
:item_id
);
.quit;

The contents of file myoutput.txt is in unreadable format.
How to get rid of this?
But data is getting inserted into the newly created table.
How is this possible?
Tags (3)
4 REPLIES
Junior Contributor

Re: Help Needed on bteq export/import option

You specified DATA in your expart command.

This is Teradata's internal binary format,
e.g. INT -> 4 byte, FLOAT -> 8 Byte IEEE format

Of course you could export/inport text, but DATA or INDICDATA is the best way for import/export from/to Teradata, using lowest resources.

Dieter

Re: Help Needed on bteq export/import option

Hi I am using the below commands in BTEQ for export and import :
.EXPORT DATA FILE=C:\Data\ProdLoads.dat;
.IMPORT data FILE=C:\Data\ProdLoads.dat,SKIP 1;

I am getting the below output for export :
*** Success, Stmt# 1 ActivityCount = 107
*** Query completed. 107 rows found. 22 columns returned. But the data is not exported to the file.

While importing it gives the error as :
*** Growing Buffer to 17263
*** Error: Import data record not terminated with LF or CF
using record size of 17263 !
*** Warning: Out of data.
Junior Supporter

Re: Help Needed on bteq export/import option

You cannot use the same file to EXPORT and IMPORT as the same time (without an EXPORT RESET between them).

Cheers.

Carlos.

N/A

Re: Help Needed on bteq export/import option

hai iam new to teradata.when iam importing my file to table iam getting the following error.please help me

.sessions 5;

.logon 127.0.0.1/dbc,dbc;

.import data file=D:\input.dat;

.repeat*;

using custid  (integer),

income        (integer),

age           (smallint),

yearswithbank (smallint),

nbrchildren   (smallint),

gender        (char(1))

insert into cust

(

cust_id  ,

income  ,

age     ,      

yearswithbank,

nchildren,

gender)values

(:custid,

:income,

:age,

:yearswithbank,

:nbrchildren,

:gender     );

.logoff;

.quit;

 *** Error: Use IMPORT to open a file first before

           trying to read from it.

 *** Failure 3593 No DATA parcel sent and request uses a USING clause.

                Statement# 1, Info =0

 *** Total elapsed time was 1 second.