Re: load from.. insert into
Posted in 2000
On Tue, 26 Sep 2000, Andreas Lommel wrote:
> Hi there ! Iwant to load ASCII-data into a table. The problem: The
> Ascii-File has many rows. Can I separate the loading ?
>
Use the dbload command:
1. Create a file called table.dbl or something similar. Here is the format
of this file:
FILE "table.unl" DELIMITER "|" x;
insert into table;
Where :
table is the name of the table
table.unl is the name of the ASCII file (this one is delimied format; you
can also have fixed column format)
x is the number of columns in table (use dbaccess / Table / Info to get this)
Example for loading the customer table from the file customer.unl. Customer
table has 8 columns:
FILE "customer.unl" DELIMITER "|" 8;
insert into customer;
2. Run the dbload command from command line:
dbload -d database -c dblfile -e 1 -l table.err -n 3000 -k
Where:
database is the name of the database
dblfile is the file from step 1
-e 1 means to abort after the first error
table.err is the file that will log errors
-n 3000 means to do a COMMIT WORK after 3000 rows (can be higher or lower,
depending on your system)
-k means to place an exclusive lock on table
Example:
dbload -d stores -c customer.unl -e 1 -l customer.err -n 3000 -k
There are other options to dbload; type dbload -- to find them.
Ron
________________________________________________________________________
Ron Flannery <mailto:rflanner@informixhandbook.com>, 248-887-8470x40
Lead author, Informix Handbook President, One Point Solutions
"Your Complete Reference" "Informix & Web/Database solutions"
http://www.informixhandbook.com http://www.one-point.com
________________________________________________________________________