Exporting InterBase Tables to an External File
Go Up to Using the EXTERNAL FILE Option
If you add, update, or delete a record from an internal table, the changes will not be reflected in the external file. So in the previous example, if you delete the “Sam Jones” record from the PEOPLE
table, and do a subsequent SELECT
from EXT_TBL
, you would still see the “Sam Jones” record.
- Note: When exporting data to or from an external file, the file must already exist before you begin the operation. Also, you must specify a directory path whenever you reference the external file.
This section explains how to export InterBase data to an external file. Using the example developed in the previous section, follow these steps:
- Open the external file in a text editor and remove everything from the file. If you then do a
SELECT
onEXT_TBL
, it should be empty. - Use an
INSERT
statement to copy the InterBase records fromPEOPLE
into the external file,file.txt
. Be sure to specify the file directory.INSERT INTO EXT_TBL SELECT FIRST_NAME, LAST_NAME, HIRE_DATE, NEW_LINE FROM PEOPLE WHERE FIRST_NAME LIKE 'Rob%';
- Now if you do a
SELECT
from the external table,EXT_TBL
, only the records you inserted should be there. In this example, only a single record should be displayed:SELECT FNAME, LNAME, HDATE FROM EXT_TBL;
FNAME LNAME HDATE ======== ================= =========== Robert Brickman 12-JUN-1992
- Important: Make sure that all records that you intend to export from the internal table to the external file have the correct EOL character(s) in the newline column.