Bteq Import Help

Tools

Bteq Import Help

Hi All,

I need some clarficiation in the BTEQ import help.

I have a table

CREATE TABLE esa_stage.offshore_test (empid INTEGER,empname CHAR(10)) PRIMARY INDEX (empid);

And sample file with data..
empid|empname
1002|Anirudh
1003|Anantha

The Bteq script is

.logon server/uid,pwd
database db1;

.import vartext '|' file='C:\Anantha\Teradata\Training\bteq_export_sample.txt' skip=1

.repeat *

using empid (integer),
empname (char(10))

insert into offshore_test(empid,empname) values(:empid,:empname);

.logoff
.quit

The script is not throwing error. instead data is getting loaded as
808,517,636 02 Anirud

But if i use Empid (varchar(4)) and empname (varchar(10)) data is getting loaded fine

Can you tell why is this issue coming and how to rectify it?

rgds
Anantha S
Tags (1)
6 REPLIES

Re: Bteq Import Help

Anantha

'.IMPORT VARTEXT' interprets input file content as variable length characters. Please note that only acceptable datatype for VARTEXT are VARCHAR, VARBYTE, and LONG VARCHAR. If you use other data type to read VARTEXT(delimited) import file, import results are not guaranteed.

If you are able to export data, use data or indicdata mode. So that you can import to a table using same table datatypes.

Re: Bteq Import Help

Vj,
Thanks for the reply ... can u clarify it a bit more...
This is my BTEQ export script
.logon server/uid,pwd
database d1;
.EXPORT indicdata file =c:\anantha\teradata\training\bteq_export_sample.txt
.set separator '|'
.set titledashes off
select * from offshore_test;
.export reset
.quit
-------

Output file is now like this ...䄀楮畲桤††††††ਠ䄀慮瑮慨††††††ਠ䄀慮瑮慨††††††ਠ䄀楮畲桤††††††ਠ

i used the same above Import script only with INDICDATA in the import line.. but it dint load and throwed error. Can u correct the script?

Am i making anything wrong here?

Re: Bteq Import Help

DATA, INDICDATA modes are binary formatted. You cannot read it in text editor.

When you export using INICDATA, then you have to import using INDICDATA.

EXPORT ---> IMPORT
DATA ---> DATA
INDICDATA ---> INDICDATA
REPORT ---> VARTEXT

---
To correct your script, you don't need to specify field separator or special column header handling

.logon server/uid,pwd
database d1;
.EXPORT indicdata file =c:\anantha\teradata\training\bteq_export_sample.txt
select * from offshore_test;
.export reset
.quit

Re: Bteq Import Help

Thanks Vj, It worked like a charm :)

will trouble you more once i get into FLOAD and MLOAD :)

Re: Bteq Import Help

Sure

Re: Bteq Import Help

Hi,
The above code worked... Just a clarification can i insert the same output from bteq export to table using FL... if so what is the condition like (UNFORMATTED,FASTLOAD)