Loading data into DB2 tables

You can use several methods to load data into DB2® tables.

The most common method for loading data into most of your tables is to use the LOAD utility. This utility loads data into DB2 persistent tables from sequential data sets by using BSAM. You can also use a cursor that is declared with an EXEC SQL utility control statement to load data from another SQL table with the DB2 UDB family cross-loader function. The LOAD utility cannot be used to load data into DB2 temporary tables or system-maintained materialized query tables.

When loading tables with indexes, referential constraints, or table check constraints, LOAD can perform several checks on the validity of data. If errors are found, the table space that is being loaded, its index spaces, and even other table spaces might be left in a restricted status. LOAD does not check the validity of informational referential constraints. Plan to make necessary corrections and remove restrictions after any LOAD job.

You can also use an SQL INSERT statement to copy all or selected rows of another table, in any of the following methods:

  • Using the INSERT statement in an application program
  • Interactively through SPUFI
  • With the command line processor

To reformat data from IMS™ DL/I databases and VSAM and SAM loading for the LOAD utility, use DB2 DataPropagator.