Sybase 12.4.2 Server User Manual


 
Inserting selected rows from the database
194
LOCATION ’detroit.asiq11db’
{ SELECT l_shipdate, l_orderkey
FROM lineitem }
The destination and source columns may have different names.
The order in which you specify the columns is important, because data
from the first source column named is inserted into the first target column
named, and so on.
You can use the predicates of the
SELECT statement within the INSERT
command to insert data from only certain rows in the table.
Example
This example inserts the same columns as the previous example, but only for
the rows where the value of
l_orderkey is 1.
INSERT INTO lineitem
(l_shipdate, l_orderkey)
LOCATION ’detroit.asiqdb’
{ SELECT l_shipdate, l_orderkey
FROM lineitem
WHERE l_orderkey = 1 }
Note If you use START ROW ID and you select fewer columns than exist in
the destination table, the columns in remaining rows of the destination table
will be NULLs, if NULLs are legal values. See “Partial-width insertions” for
more information.
Importing data from
pre-Version 12
Adaptive Server IQ
To import data from an Adaptive Server IQ database version earlier than 12.0,
you must use of the following methods:
•The
LOAD TABLE command with the UNLOAD FORMAT option.
•The
INSERT...LOCATION syntax
You cannot use other forms of the
INSERT command.
For more information on loading from an older version, see the Adaptive
Server IQ Installation and Configuration Guide.