Was this helpful?
Load Fixed-Length and Binary Records
The COPY statement can also load data from fixed-length records without any delimiters in or between the data. In addition, numeric items in the file can be stored in true binary format. For example, the value 256 can be stored in a 2-byte integer instead of 3 characters. The order header file has the following record layout:
orderno date suppno suppinfo status
The data type formats for each of the fields is as follows:
(2-byte int) (8 chars) (2-byte int)
(35 chars) (1 char)
In this case, you code the COPY statement to load the header table as follows:
COPY TABLE header (orderno = INTEGER2,
    date = CHAR(8),
    suppno = INTEGER2,
    dummy = CHAR(35),
    status = CHAR(1))
    FROM 'file1';
It is also possible to copy data from files that contain both fixed and variable-length fields.
Last modified date: 08/14/2024