cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Multirow inserts

Former Member
14,452

Sybase has the ability to make an insertion multi rows? If yes, what version is available? If not, has plans to develop?

View Entire Topic
Former Member

Do you mean a VALUES clause on an INSERT statement that permits multiple rows? Something like this:

INSERT INTO T VALUES( (col1_value, col2_value), (col1_value, col2_value), ... )

This is supported in version 12 - I cannot recall whether or not this shipped in 12.0.0 or 12.0.0. See the documentation at dcx.sybase.com.

If you are thinking of another construction (ie. multi-row inserts thru JDBC or ODBC), these are also supported and have been for some time.

VolkerBarth
Contributor

FWIW, this enhancement has been introduced with v12.0.0, cf. this page:

INSERT statement enhancements
The following enhancements have been made to the INSERT statement. See INSERT statement.

Support for more than one list of values
An INSERT statement can now contain more than one list of values, allowing several rows to be inserted at once. For example:
INSERT INTO T (c1,c2,c3)
VALUES (1,10,100), (2,20,200), (3,30,300);

Support for inserting rows with all default values
SQL Anywhere allows the VALUES clause to contain specified values for a subset of the columns in the table. All unspecified columns are given default values as specified for each column by means of DEFAULT, NULL and COMPUTE clauses of the CREATE TABLE statements. Previously, the database server required that you specify input values for at least one of the columns in the table.