Subject Re: [firebird-support] Firebird Data Input
Author Helen Borrie
At 01:12 PM 15/07/2004 +0000, you wrote:
>Hi All!!!
>
>Can I input data into a firebird database using a flat text file and
>if so - HOW?
>
>Thanx!!

There are various ways...

If you can get the input file into fixed length format, you simply need to
declare an external table in the database with CHAR columns for each input
field. Then, you read the file as a table. The file has to be on the same
system as the server. The table syntax is
CREATE TABLE tablename
EXTERNAL FILE '<path-to-file>' (
<columns....>

If you're very careful with the input format, you can actually declare the
columns as specific types. However, it's usually simplest to read them all
in as CHAR (never VARCHAR, though you can cast to VARCHAR
afterwards...). Then query this table - through a SP for convenience of
error logging, casting, etc. - and write to your "real" tables.

The SQL buzzword for this feature is "external virtual table", or
"EVT". IBM is trumpeting it as the latest-greatest that they just invented
for DB2....little do they know Firebirds old rellies had them when IBM used
to need a truck to ship a 1-Megabyte hard drive.

Other ways include writing an import application using a programming
interface that supports it, e.g. IBObjects or CleverComponents for Delphi,
Kylix, BCB, etc., or using an admin tool that supports text
importing. See the Downloads|Contributed sections at www.ibphoenix.com for
a lot of offerings. See LangRef.pdf for a bit more info.

/heLen