I was able to do fill tables with data from Excel file or text files using GUI utility Teradata Sql assistant. But now I have a requirement to import data into teradata tables from excel file using a bteq script. I have been trying to do that using
.IMPORT REPORT
.IMPORT DATA
.IMPORT VARTEXT and I have tried other things also, but of no use. I have referred to some answers in teradataforum and googled for the same but my script is not working. Please help me with a script which will import data from excel file or atleast text file using BTEQ script.My script is as follows...
.LOGON XXXX/XXXXXX,XXXX
.import data FILE = D:\XX\XXXX.xls ;
.QUIET ON
.REPEAT *
USING COL1 (CHAR(1))
,COL2 (CHAR(1))
,COL3 (VARCHAR(100))
INSERT INTO DATABASE.TABLE
( COL1
,COL2
,COL3)
VALUES ( :COL1
,:COL2
,:COL3);
.QUIT
EDIT:
Till now I came this long. I have successfully loaded data from comma separated text file using the following code. But how to do it in Excel?
.LOGON xxxx/xxxx,xxxx
.IMPORT VARTEXT ',' FILE=xxxxx.TXT;
.QUIET ON
.REPEAT *
USING
( col1 VARCHAR(2)
,col2 VARCHAR(1)
,col3 VARCHAR(60)
)
INSERT INTO database.table
( col1
,col2
,col3)
VALUES ( :col1
,:col2
,:col3);
.QUIT
Sample comma separated text file being
1,B,status1
2,B,status2
3,B,status3
etc.
Please help me if possible to load the same with Excel file.