2. Creating a Database : How You Create a Database Using Ingres Commands : Populate a Table Using the COPY Statement
 
Share this page                  
Populate a Table Using the COPY Statement
The SQL statement COPY can be used to copy the contents of a file into a table.
Note:  The input file for the following COPY statement is a binary file. To create this file, use this statement:
COPY TABLE airport () INTO 'airport.in';
To load the airport table from a binary file
Issue the following statement:
COPY TABLE airport () FROM 'airport.in';
To load the airport table from a CVS file
Alternatively, if the data file is in comma-separated value (.csv) format, you must specify the character types and the delimiter on the COPY statement. This method allows more flexibility and lets you skip fields. The COPY statement would look like this:
COPY airport (
    ap_id=char(0) comma,
    ap_iatacode=char(0) comma,
    ap_place=char(0) comma,
    ap_name=char(0) comma,
    ap_ccode=char(0) nl)
FROM 'airport.csv';
For more information on the COPY statement, see the SQL Reference Guide and the Database Administrator Guide.