CHAPTER 5 Moving Data In and Out of Databases

Redirecting output and messages

The >& redirection symbol redirects all output including error messages and statistics for the command on which it appears. For example:

SELECT * FROM employee >& empfile

Do not enclose the file name in quotation marks.

This example outputs the SELECT statement to the file empfile, followed by the output from the SELECT statement and some statistics pertaining to the command.

The >& redirection method is useful for getting a log of what happens during a READ command. The statistics and errors of each command are written following the command in the redirected output file.

NULL value output

The most common reason to extract data is for use in other software products.

The other software package may not understand NULL values, however.

The DBISQL option NULLS allows you to choose how NULL values are output. Alternatively, you can use the IFNULL function to output a specific value whenever there is a NULL value.

For information on setting DBISQL options, see “SET OPTION statement” in

Adaptive Server IQ Reference Manual.

Bulk loading data using the LOAD TABLE statement

The LOAD TABLE statement is used for efficient importing of data from a text or binary file into an existing database table. It loads data into any column indexes you have defined, as well as any created automatically.

In order to use the LOAD TABLE statement, you need INSERT permission on the table.

See the description of the ON FILE ERROR load option for what happens when errors occur during a load.

175

Page 195
Image 195
Sybase 12.4.2 manual Bulk loading data using the Load Table statement, Null value output, 175