fastload: Ignoring Quote while importing

Tools
Enthusiast

fastload: Ignoring Quote while importing

Hi

I have a very big text datafile. Each text record (variable length) is enclosed by quotes("---") and records are seperated by semicolon[;]. But it seems teradata import the quotes while importing. I am wondering if there is any way to ingore the quotes.

Here is the sample file.

"a";"bb";"c";"ddddd"
"aa";"b";"ccccccccc";"ddddd"
......

I am using the follwoing script:

CREATE SET TABLE char10k_10(
char_1 char(100) DEFAULT NULL,
char_2 char(100) DEFAULT NULL,
char_3 char(100) DEFAULT NULL,
char_4 char(100) DEFAULT NULL
);

SET RECORD VARTEXT ";";
DEFINE
char_1(varchar(100)),
char_2(varchar(100)),
char_3(varchar(100)),
char_4(varchar(100))
FILE=char10k_10.txt;

BEGIN LOADING char10k_10 ERRORFILES fld_err_tb1,fld_err_tb2
checkpoint 100000;
INSERT INTO char10k_10 values
(
:char_1,
:char_2,
:char_3,
:char_4
);

END LOADING;

Amy help would help.

-regards
Mahib
2 REPLIES
Enthusiast

Re: fastload: Ignoring Quote while importing

I had a similar situation and decided to just use the (") as the delimiter character. Then, you just have to skip over the fields that have the ( ;-) . So, in your first record, the first field would contain nothing, the second field would contain an 'a', the 3rd field would contain a ';', the 4th field would contain a 'bb', etc.

I hope that helps.
Teradata Employee

Re: fastload: Ignoring Quote while importing

Are you using Unix? If so then you can strip out the single quotes before the fastload is started. This example assumes you do NOT have quotes in the data itself. The original file is renamed myfile.dat.bak

perl -i.bak -ne 's/\x27//g;print' myfile.dat