Transferring data into the database

Data can be copied into a database from program variables or from a flat file on the client’s host machine.

When you are copying data into a database table, the chief advantage of bulk copy over the alternative SQL insert command is speed. Also, SQL insert requires that the data be in character string format, while bulk copy can transfer native datatypes.

When copying data into a non-indexed table, the “high speed” version of bulk copy is used, which means that no data logging is performed during the transfer. If the system fails before the transfer is complete, no new data will remain in the database. Because high-speed transfer affects the recoverability of the database, it is only enabled if the Adaptive Server option select into/bulkcopy has been turned on. If the option is not enabled, and a user tries to copy data into a table that has no indexes, Adaptive Server generates an error message.

After the bulk copy is complete, the System Administrator should dump the database to ensure its future recoverability.

When you copy data into an indexed table, a slower version of bcp is automatically used, and row inserts are logged.

To copy data into a database, a DB-Library/C application must perform the following introductory steps:

At this point, an application copying data from program variables will need to perform different steps than an application copying data from a host file.

To copy data from program variables, a DB-Library/C application must perform the following steps in addition to the introductory ones listed previously:

To copy data from a host file, a DB-Library/C application needs to perform the following steps in addition to the introductory ones listed previously: