SQL/MX 2.x Installation and Management Guide (G06.24+, H06.03+)
Reorganizing SQL/MX Tables and Maintaining Data
HP NonStop SQL/MX Installation and Management Guide—523723-004
10-30
Examples of Using import to Load an SQL/MX Table
Example 1: Importing Data From a Delimited Input Data File
In this example, the input file, COINPUT, contains records like this:
1,"Test String 1","111-222-3333","222-333-4444"
2,"Test String 2","111-222-3333","222-333-4444"
3,"Test String 3","111-222-3333","222-333-4444"
4,"Test String 4","111-222-3333","222-333-4444"
5,"Test String 5","111-222-3333","222-333-4444"
6,"Test String 6","111-222-3333","222-333-4444"
7,"Test String 7","111-222-3333","222-333-4444"
8,"Test String 8","111-222-3333","222-333-4444"
Suppose that you want to import data into the COMPANY table from the fixed-width
and delimited COINPUT input file by using a format file. The format file created,
FORMFILE, consists of [DATE FORMAT], [COLUMN FORMAT], [DELIMITED
FORMAT], and [FIXED WIDTH FORMAT] sections:
[DATE FORMAT]
DateOrder=MDY
DateDelimiter=/
TimeDelimiter=:
FourDigitYear=Y
DecimalSymbol=.
[COLUMN FORMAT]
col=id,N
col=company,N
col=phone,N
col=fax,N
[DELIMITED FORMAT]
FieldDelimiter=,
RowDelimiter=\n
Qualifier="
Perform the import command to load the COINPUT input file into the COMPANY
table. This import command imports data into the COMPANY table from the delimited
input file named COINPUT using the format file FORMFILE:
import cat.sch.company -I COINPUT -U FORMFILE -W DELIM
The format file (FORMFILE) can also be used as a delimited input data file. However,
the [FIXED WIDTH FORMAT] section is required only for fixed width input data files,
and is not provided in the format file in this example.
Example 2: Importing Data From a Fixed Width Input Data
File
In this example, the input file, COINPUT, contains records like this:
1,ibm",408-111-2222,408-222-3333
2,apple,408-222-1111,408-333-2222