Partial-width insertions

By default, new rows are inserted wherever there is space in the indexes, and each LOAD TABLE or INSERT statement starts a new row. This approach works as long as the data you are inserting is a new row. Sybase IQ also lets you insert individual columns into an existing row, if you specify its rowid.

A partial-width insertion, also called a vertical insertion, is an insertion into a subset of columns in a table. You can use two or more partial-width insertions to insert data into all of the columns of the table.

Partial-width insertions let you:

WARNING! This is an advanced operation. If you do not perform all the steps correctly in a partial-width insert, you may insert data incorrectly. Never use this type of insert unless you are an experienced Sybase IQ user and are very familiar with your data. Full-width inserts, which insert into all the column indexes on a table at the same time, ensure row-level integrity and are less error-prone.

Use START ROW ID to specify at which row you want to start the insert. This allows you to insert into some of the columns in a row with one partial-width INSERT or LOAD TABLE statement, and insert into the other columns in the same row with additional INSERT or LOAD TABLE statements.

Partial width inserts are not recommended on partitioned tables, as the START ROW ID clause of the LOAD TABLE and INSERT commands is not supported on a partitioned table.

If you try to insert into a column that already contains data, you get an error.

You must be sure to control the row at which each insertion starts. If you do not use START ROW ID, your insertion begins with the next row, and NULLs are inserted in the remaining columns of the current row, as shown in Figure 7-1. (The two shading patterns represent data inserted into columns in two separate insert operations.)

Figure 7-1: Using START ROW ID with partial-width insertions

Shown is a diagram using start row with partial width insertions

NoteDo not try to perform a partial-width insertion using the INSERT VALUES command format. Because you cannot specify START ROW ID using this format, the problem shown in the figure results.