CHAPTER 5 Moving Data In and Out of Databases

2For the second and any subsequent partial-width inserts for the same set of rows, use the START ROW ID option to specify the row where the insert started. This number is the record number at the beginning of the insert message log, as in this example:

In table ’department’, the full width insert of 3 columns

will begin at record 1.

 

You can also use the ROWID function to display the row ID, as in the following

 

query:

 

 

 

 

SELECT *, ROWID(table_name) FROM table_name

Example 1

The UNIX example below shows an incorrect insertion of four columns from

 

the file tt.t into the indexes on the lineitem table. It inserts the first two columns

 

with one LOAD TABLE statement and the second two columns with another

 

LOAD TABLE statement, but does not use the START ROW ID option to align the

 

additional columns.

 

 

 

LOAD TABLE lineitem

 

 

 

(l_partkey ASCII(4),

 

 

 

l_suppkey ASCII(4),

 

 

 

FILLER(13))

 

 

 

FROM ’/d1/MILL1/tt.t’

 

 

PREVIEW ON

 

 

 

NOTIFY 1000

 

 

 

LOAD TABLE lineitem

 

 

 

(FILLER(8),

 

 

 

 

l_quantity ASCII(6),

 

 

 

l_orderkey ASCII(6),

 

 

 

FILLER(1))

 

 

 

FROM ’/d1/MILL1/tt.t’

 

 

PREVIEW ON

 

 

 

NOTIFY 1000

 

 

 

The result of the SELECT statement below shows that 10 rows are stored

 

instead of the correct number of 5.

 

 

SELECT *, rowid(lineitem) FROM lineitem

l_orderkey

l_partkey l_suppkey l_quantity

rowid(lineitem)

----------

---------

---------

------------

---------------

NULL

1

12

NULL

1

NULL

2

37

NULL

2

199

Page 219
Image 219
Sybase 12.4.2 manual Query, Additional columns, Instead of the correct number, 199