Subject RE: [firebird-support] External Tables
Author Helen Borrie
At 07:39 AM 22/06/2005 +0200, you wrote:
>Thanks, its now working
>
>One more question please:
>
>According to the documentation I must add a field at the end of 2Bytes that
>will indicate the "EOL" Character
>
>So if I populate my External table : exp_patient_demo
>
>Insert into exp_patient_demo(patient_id, first_name, last_name, EOL_FIELD)
>select id_patient_master, first_name, last_name, ???
> from patient_master
>
>How do I add the eol character through a SQL qry

Here's a "Firebird-support special" for you. I got it from Dmitry
Sibriryakov. I don't know where he got it. :-))

Define a smallint column as the last column in the table:

alter table mytable
add EOL_FIELD smallint default 2573;
commit;

Now, in DSQL, you can do this (assming the file is for use on Windows):

Insert into exp_patient_demo(patient_id, first_name, last_name)
values (whatever....)

That is, if you ignore the EOL character in your insert statement, the
engine will write this 2-byte number automagically. The two bytes are of
course 0D 0A which, in ascii, is ch(13)||ch(10). a.k.a. "CRLF".

./heLen