(Similar question related to SQL Server : SO Link)
I know in Sql Server 2008 or above, you can insert multiple rows doing the following:
INSERT INTO
Looks like that syntax is not valid in Sybase ASE but as suggested in the linked SO post you can get the same using UNION ALL
like
INSERT INTO MyTable (Name, ID)
SELECT 'First',1
UNION ALL
SELECT 'Second',2
UNION ALL
SELECT 'Third',3
try this:
INSERT INTO MyTable (Name, ID)
Select 'First',1
Union All
Select 'Second',2
Union All
Select 'Third',3
I know this works on older versions of SQL server, and suspect that it will work with sybase.
Sybase doen't have insert syntax as SQL Server. What's wrong with showed below classic method?
INSERT INTO MyTable (Name, ID) VALUES ('First',1)
INSERT INTO MyTable (Name, ID) VALUES ('Second',2)
INSERT INTO MyTable (Name, ID) VALUES ('Third',3)
go
The syntax in SQL Server for this example will not work in Sybase. Either go with individual statements, or UNION ALL clause