Loading data into a table using SQL

A simple method of loading data into a table is to use an SQL application and the SQL INSERT operation.

Consider a situation in which a Spiffy regional center needs to add inventory items to a dealership's inventory table on a periodic basis as regular inventory shipments are made from the regional center to the dealership.

INSERT INTO SPIFFY.INVENT
   (PART, DESC, QTY, PRICE)
 VALUES
  ('1234567', 'LUG NUT', 25, 1.15 )

The preceding statement inserts one row of data into a table called INVENT in an SQL collection named SPIFFY.

For each item on the regular shipment, an SQL INSERT statement places a row in the inventory table for the dealership. In the preceding example, if 15 different items were shipped to the dealership, the application at the regional office could include 15 SQL INSERT statements or a single SQL INSERT statement using host variables.

In this example, the regional center is using an SQL application to load data into a table at a server. Runtime support for SQL is provided in the IBM i licensed program, so the server does not need the IBM Db2 Query Manager and SQL Development Kit for i licensed program. However, IBM Db2 Query Manager and SQL Development Kit for i is required to write the application.