CHAPTER 5 Moving Data In and Out of Databases

LOAD TABLE nn (l_orderkey,

l_quantity ASCII(PREFIX 2), FILLER(2),

FROM ’C:\\iq\archive\\mill.txt’

BYTE ORDER LOW

 

LIMIT option

Specifies the maximum number of rows to insert into the

 

table. The default is 0 for no limit.

 

LIMIT works together with the SKIP option. SKIP indicates where to begin

 

reading from the input file, and LIMIT specifies how many of those rows to

 

insert. SKIP takes precedence over LIMIT. If you specify multiple input files,

 

these options only affect the first file. The following table shows how these

 

options work together:

 

Table 5-1: SKIP and LIMIT insert options

 

And the LIMIT

 

 

 

 

 

 

 

If the SKIP value is

value is

 

Then IQ does this

 

 

 

 

 

0

5

 

Reads 5 rows and inserts 5 rows.

 

 

 

 

 

20

5

 

Reads 25 rows and inserts 5 rows.

 

 

 

 

 

10

5

 

Reads 10 rows and inserts 5 rows. If the input file

 

 

 

has only 8 rows, then zero rows are inserted.

 

 

 

 

 

Here is a Windows NT example. In this case, no rows are skipped, and up to 1,000,000 rows are inserted.

LOAD TABLE lineitem (l_shipmode ASCII(15), l_quantity ASCII(8), FILLER(30))

FROM ’C:\\iq\archive\\mill.txt’ BLOCK FACTOR 1000

PREVIEW ON LIMIT 1000000

NOTIFY option Specifies that you be notified with a message each time the specified number of rows is inserted successfully into the table. The default is every 100,000 rows. Very frequent notifications can slow down your insert operation. To turn off NOTIFY entirely, set NOTIFY = 0. See “Interpreting notification messages” for an explanation of messages.

ON FILE ERROR option Specifies the action Adaptive Server IQ takes when an input file cannot be opened, either because it does not exist or because you have incorrect permissions to read the file. For all other reasons or errors, it aborts the entire insertion. You can specify one of the following:

183

Page 203
Image 203
Sybase 12.4.2 manual Specifies the maximum number of rows to insert into, Table. The default is 0 for no limit, 183