1. Open a txt file and write the following with valid replacement values (where you see <>),
.logon <server name>/<user name>, <password>;
SET session dateform=ansidate;
DATABASE <database name>;
SEL date;–to select current date
SEL time;–to select current time
CREATE VOLATILE TABLE <table name>
(Column1 CHAR (10),
Column2 CHAR (10))
ON COMMIT PRESERVE ROWS;
select count(*) from <table name>; — To check the count before insert.
.import report file=C:\<Mypath>\<MySubpath>\<MyDir>\<MyDatafile>;
.quiet on – remember it is “quiet” and not quite this is to limit output reporting
.repeat* – used with import to read until EOF is reached.
USING (col1 char(8), col2 char(8))
INSERT INTO <table name> (Column1, Column2)
values (:col1, :col2);
.quiet off – used to print output to logfile
select count(*)from <table name>;
.QUIT ERRORCODE ;
2. Save the file as MyImportfile.txt
3. Run/Execute the MyImportfile.txt from DOS (from NCR dir) as follows;
bteq < MyImportfile.txt > MyImportfile.log
The sample data inside MyDatafile looks like follows;
11111111 2222222
33333333 4444444
55555555 6666666
77777777 8888888
99999999 1010101
12121212 13131313
14141414 15151515
16161616 17171717
18181818 19191919
20202020 21212121
There is a space in between the 1st data and the 2nd data column.
Popularity: 19% [?]
Our Random Articles
- How To Choose A Good Online Traffic School
- New Year Wishes 2010
- New Year Wishes
- How to use EXTRACT function with date and time columns
- How to Post on a Separate/New Page in WordPress
More Links




1 Comment
Thanks for the useful post. I have a ques. Can we use the imported data in multiple SQL statements within the same bteq script.
Popular Articles