BTEQ DATA FILE

Tools & Utilities
Enthusiast

BTEQ DATA FILE

Hello All,

I am new to teradata. When i ran the BTEQ script to export the data. It got exported. When i tried to import the same data in the table, the output is different. Please help me know where i am going wrong.

Tables

CREATE SET TABLE anil.SourceT1

     (

      StudId INTEGER,

      StudName CHAR(8) CHARACTER SET LATIN NOT CASESPECIFIC,

      CourseId INTEGER)

PRIMARY INDEX ( StudId );

CREATE SET TABLE anil.TargetT1 

 (

StudId INTEGER,

StudName CHAR(8) CHARACTER SET LATIN NOT CASESPECIFIC,

CourseId INTEGER)

PRIMARY INDEX ( StudId );

INS INTO anil.SourceT1  values (1,'Anilx',200);

BTEQ Scripts 

.logon 127.0.0.1/Anil143,341

.SET WIDTH 500;

.SET TITLEDASHES OFF;

.export data file=output1.txt

sel * from anil.SourceT1;

.export reset

.logoff

 --------------------------------------

.logon 127.0.0.1/Anil143,341

.import indicdata file=/root/anil/output1.txt

.quiet on

.repeat*

using

      in_StudId (INTEGER),

      in_StudName (CHAR(9)),

      in_CourseId (INTEGER)

insert into anil.TargetT1 values(:in_StudId,:in_StudName,:in_CourseId);

.logoff

------------------------------------------------------------

sel * from anil.TargetT1;

output

StudId               StudName  CourseId

1,241,513,984    nilx           25,632

Thanks in Advance.

Anil 

Tags (1)
1 REPLY
Junior Contributor

Re: BTEQ DATA FILE

Hi Anil,

you EXPORT DATA, but IMPORT INDICDATA, it should be the same for both EXPORT and INPORT.

INDICDATA keeps information about NULLs, when your data actually has NULL you should use this over DATA. 

Btw, you probably got an error message when you used CHAR(8) and then changed it to CHAR(9) to fix it :-)