Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebird External Tables

I am trying to find a way to quickly load a lot of data into database and one suggested to use Firebird External Tables, I would like know more about this method, I've tried searching online but I'm not getting the useful information about this, I want to know how do they really work? Do the tables have to be exactly the same? and what if you are loading data from more than one database?

like image 482
Alec Avatar asked Aug 27 '14 07:08

Alec


1 Answers

Use external tables like this:

CREATE TABLE ext1 EXTERNAL 'c:\myfile.txt'
(
field1 char(20),
field2 smallint
);

To do quick import into regular table, do something like this:

INSERT INTO realtable1 (field1, field2)
SELECT field1, field2 FROM ext1;

Remember to disable triggers and indexes (if possible) before loading, and reactivate them after.

This information is from Firebird FAQ: http://www.firebirdfaq.org/faq209/

Here's more information about using external tables, including information about file format: http://www.delphiman.de/Bin/UsingExternalFilesAsTables.pdf

like image 164
Harriv Avatar answered Oct 30 '22 01:10

Harriv