5. Populating Tables : Formatted Copying : Reload Formatted Data
 
Share this page                  
Reload Formatted Data
Use the following form of the COPY statement to reload a table from a file containing formatted data:
COPY [TABLE] [schema.]tablename
  ([column_name = format [WITH NULL [(value)]]
  {, column_name = format [WITH NULL[(value)]]}])
  FROM 'input_filename' [standard-with-clauses]
  [bulk-copy-with-clauses]
The input file name can contain user-created data for reading in new data to a table, or a formatted file created by a COPY INTO statement. You must specify the column names in sequence according to the order of the fields in the formatted file (that is, the same order in which they appeared in a COPY INTO statement). The format does not have to be the same data type or length as their corresponding entries in the file. The target table can be empty or populated; in the latter case, the COPY FROM operation merges the new data from the file with the existing table data.