Using the INSERT statement
190
Using the INSERT statement
The INSERT statement allows you to insert data without first putting it into a
flat file. Using this command, you can either:
• Insert a specified set of values row by row
• Insert directly from database tables
See the sections that follow for details of these two forms of the command.
Inserting specified values row by row
To add specified values to a table row by row, use the INSERT statement with
this syntax:
INSERT [ INTO ]
[
owner
.]
table_name
[ (
column_name
, ...) ]
... VALUES (
expression
...)
Adaptive Server IQ inserts the first value you specify into the first column you
specify, the second value you specify into the second column, and so on. If you
omit the list of column names, the values are inserted into the table columns in
the order in which the columns were created (the same order as
SELECT *
would retrieve). Adaptive Server IQ inserts the row into the table wherever
room is available.
Values can be NULL, any positive or negative number, or a literal.
• Enclose values for
CHAR, VARCHAR, DATE, TIME, and TIMESTAMP or
DATETIME columns in single or double quotation marks. To indicate a
value with a quotation in it use a different set of quotes for the outer quote,
such as “Smith' s”.