Brad
Brad

Reputation: 15879

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

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?

Upvotes: 2

Views: 13185

Answers (2)

user12811525
user12811525

Reputation: 1

This seems long ago asked question but may be useful for reference. Create a Text file with multiple Rows.

Run this command from Sybase ASE:

INPUT INTO TableName
FROM FilePath\FileName FORMAT TEXT

Example:

INPUT INTO TempTable FROM c:\test.txt FORMAT TEXT

Upvotes: -1

kolchanov
kolchanov

Reputation: 2088

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

Upvotes: 5

Related Questions