Sybase 12.4.2 manual Bulk loading data using the Load Table statement, 176

Models: 12.4.2

1 536
Download 536 pages 20.34 Kb
Page 196
Image 196
LOAD TABLE

Bulk loading data using the LOAD TABLE statement

Using command files to load data

Transaction processing and LOAD TABLE

Summary of LOAD TABLE syntax

Load specification

To load large amounts of data, most users create command files. To create a command file, follow the instructions in the chapter entitled “Getting Started with DBISQL” in the Introduction to Adaptive Server IQ.

When you issue the LOAD TABLE statement for an IQ table, a savepoint occurs automatically before the data is loaded. If the load completes successfully, Adaptive Server IQ releases the savepoint. If the load fails, the transaction rolls back to the savepoint. This approach gives you flexibility in committing

transactions. For example, if you issue twocommands, you can ensure that either both commit or neither.

When you issue LOAD TABLE for a Catalog Store table, there is no automatic savepoint. If the load succeeds, it commits automatically. If the load fails, it rolls back. You cannot roll back a successful load of a Catalog Store table.

For more information on transaction processing, see Chapter 8, “Transactions and Versioning”.

The basic form of the LOAD TABLE statement is:

LOAD TABLE [ owner ].table-name [ ( load-specification, ... ) ]

FROM filename-string’, ...

[ FORMAT { ’ascii’ ’binary’ } ]

... [ DELIMITED BY string ]

... [ STRIP { ON OFF } ]

... [ QUOTES { ON OFF } ]

... [ ESCAPES { ON OFF } ]

[ ESCAPE CHARACTER character ]

[ WITH CHECKPOINT ONOFF ]

... [ load-options ]

The load-specificationdoes the following:

Lists each column to be loaded and describes the data in it. A column can contain fixed-length data, variable-length characters delimited by a separator, or data that uses a binary prefix to represent the number of bytes being read.

Specifies FILLER format for any fields you want to skip.

The syntax for load-specificationis as follows:

load-specification:

{column-name [ column-spec ] FILLER ( filler-type ) }

176

Page 196
Image 196
Sybase 12.4.2 manual Bulk loading data using the Load Table statement, 176, Format ’ascii’ ’binary’ Delimited by string