community.borland.com

Article #25142: Import and export new line character to external file

Problem:
Looking for example of how to export a new line to external file.

Solution:
IB V4.x

This is an example for UNIX.  On Windows platforms, new line character 
is 2 bytes. You need to define the field newline to be a char(2) instead of
char(1).

This is the content of an external file named extfile in /usr/jli directory:

jennyli
terrywu
cathyho
Pennygi
MinnyMO

Start ISQL and do the following:

isql>create table ext_tbl external file "/usr/jli/extfile" (fname char(5),
  lname char(2), newline char(1));
  
isql>create table people (fname char(5),
  lname char(2), newline char(1));
  
isql>insert into people select fname,lname,newline from ext_tbl;

isql>select * from people;

The select query will return this:
---------------------------------
FNAME  LNAME  NEWLINE 
====== ====== ======= 

jenny  li     
       
terry  wu     
       
cathy  ho     
       
Penny  gi 
       
Minny  MO 

---------------------

Here is an example of how to export the newline character;

> create table ext_tbl2 external file "/usr/jli/extfile2" (fname char(5),
  lname char(2), newline char(1));
  
This will create a blank external file.
  
>insert into ext_tbl2 select fname,lname,newline from people;

Now you can view extfile2 and see that layout is the same as extfile.

Last Modified: 28-SEP-00