Inserting From A Different Database - Sybase Adaptive Server IQ 12.4.2 Administration And Performance Manual

Table of Contents

Advertisement

Inserting selected rows from the database
Example

Inserting from a different database

192
SKIP number-of-rows
START ROW ID number
This form of the
INSERT
based on the results of a general
For maximum efficiency, insert as many rows as possible in one
statement. To insert additional sets of rows after the first insert, use additional
statements.
INSERT
Like other SQL databases, Adaptive Server IQ inserts data by matching the
order in which columns are specified in the destination column list and the
select list; that is, data from the first column in the select list is inserted into the
first destination column, and so on. For both
, if you omit destination column names, Adaptive Server IQ inserts
VALUES
data into columns in the order in which they were created.
The tables you are inserting into must exist in the database you are currently
connected to. Adaptive Server IQ inserts the data into all indexes for the
destination columns. (
The columns in the table in the select-list and in the table must have the same
or compatible data types. In other words, the selection's value must be, or must
be able to be converted to, the data type of the table's column. See "Converting
data on insertion" for more information about data types and conversion
options.
With this form of the
INSERT
insert-load-options:
The
option lets you perform a partial-width insert. Read
START ROW ID
"Partial-width insertions" before you specify this option.
For an explanation of all of these options, see "Specifying load options".
This example shows an insert from one table,
within the same database. The data from the source column
inserted into the destination column
INSERT INTO partsupp(ps_availqty)
SELECT l_quantity FROM lineitem
You can insert data from tables in any accessible database:
statement lets you insert any number of rows of data,
statement.
SELECT
INSERT SELECT
statement you can specify any of the following
partsupp
.
ps_availqty
INSERT
and
INSERT
, to another,
,
lineitem
is
l_quantity

Advertisement

Table of Contents
loading

Table of Contents