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-29
Examples of Using import to Load an SQL/MX Table
•
Run multiple instances of the import command—one for each partition in the
destination table—to load data into a partitioned table by using a single input file.
For each import command, specify the number of input rows (records), the
number of the first record to import, and the transaction size.
For example, suppose that you partition the EMPLOYEE table into three partitions.
The first partition begins with 0 (zero) for the employee number, the second
partition begins with 3000 for the employee number, and the third partition begins
with 5000 for the employee number.
You might specify the three import commands as follows:
/usr/bin:import corpcat.persnl.employee -I empfile -C 2999 -T 500
/usr/bin:import corpcat.persnl.employee -I empfile -C 1999 -F 3000 -T 500
/usr/bin:import corpcat.persnl.employee -I empfile -C 1999 -F 5000 -T 500
The count of the number of records for each partition must be less than or equal to
the space available in each partition, and the rows to be imported into each
partition must have an appropriate clustering key. In the preceding example, the
first partition permits employee numbers ranging from 0 to 2999.
•
Run multiple instances of the import command—one for each partition in the
destination table—to load data into a partitioned table by using a separate input file
for each partition. Each of the input files contains the data for each partition.
For example, you might specify the three import commands for the partitioned
EMPLOYEE table as:
/usr/bin:import corpcat.persnl.employee -I empfile1 -T 500
/usr/bin:import corpcat.persnl.employee -I empfile2 -T 500
/usr/bin:import corpcat.persnl.employee -I empfile3 -T 500
Examples of Using import to Load an SQL/MX Table
The next two examples demonstrate how to use import to load the SQL/MX table
COMPANY from the input file COINPUT. The example shows the schema of the table
to be loaded, the data to be loaded (the input data file), the format file describing the
data, and the import command used to load it.
First, create the table COMPANY into which to import the file:
CREATE TABLE company
( id INT NOT NULL
,company VARCHAR (176)
,phone VARCHAR (12)
,fax VARCHAR (12)
,PRIMARY KEY (id)
);
Note. Check that the ranges specified are exact. For example, check that there are no
gaps or omissions and no overlap of rows.