Subject Re: [firebird-support] external file table and CR/LF
Author Lele Gaifax
>>>>> "Ann" == Ann Harrison <aharrison@...> writes:

Ann> Brian Schembri wrote:
>>> ... I cannot get to insert a CR/LF in the rows.
>>>
Ann> What I've done when I need that is to create a text file
Ann> containing a CR/LF, create a table definition that maps to
Ann> that table, including a char(2) field for the CR/LF, then
Ann> create a table in the database with a char(2) field called
Ann> CR_LF. Insert into the database table selecting values from
Ann> the external table. Now you have a CR/LF in the database
Ann> which you can include when you insert into your external
Ann> file.

Just to share a dirty and probably highly NonPortable hack that
automatically accomplishes the above, something like this worked for
me:

CREATE TABLE extable EXTERNAL FILE '/path/to/table.txt'
(
field1 domain1,
field2 domain2,
...
cflf SMALLINT DEFAULT 2573 NOT NULL
)

It just happens that a smallint is a two byte number, and 2573 is
decimal of ASCII CF+LF... :-)

You can forget your line separators, then :-)

ciao, lele.
--
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
email: lele@... | -- Fortunato Depero, 1929.