How can I insert multiple records with a single INSERT statement in Sybase ASE

Go To StackoverFlow.com

2

This feature is available in MySQL as shown in this post and according to the Sybase documentation it should also be supported, however Sybase don't provide a worked example so you have to interpret the following:

Syntax 1 Insert a single row, or multiple rows, with the specified expression column values. Multiple rows, if specified, are delimited by additional parentheses

So I interpret "additional parentheses" as expecting the following code to work

create table #tmp_codes (
    code varchar(12) NULL
)

insert into #tmp_codes (code) 
values
    ('AAA'),
    ('BBB'),
    ('CCC')

However it errors with

Incorrect syntax near ',' on line 7

I'm using Sybase ASE 15 and cannot see any reference to inserting multiple rows on this support page for the INSERT statement

Is this feature available in Sybase?

2012-04-05 15:13
by Brad


5

Your first Sybase doc link is ASA not ASE documentation. In ASE you can insert multiple rows only with insert - select statement.

2012-04-06 06:44
by kolchanov
Ads