I am trying to unite a number of operations into one block in Sybase SQL, in the following way:
BEGIN TRANSACTION MyInsert;
INSERT INTO dbo.Agencies (code, name) VALUES ( 1, 'My Group');
INSERT INTO dbo.Agencies (code, name) VALUES ( 2, 'Their Group');
COMMIT TRANSACTION MyInsert;
When the INSERT
statements execute by themselves, they execute just fine and the rows are inserted. When I execute the block, I get the error
Incorrect syntax near the keyword 'BEGIN'.
I tried marking the block with BEGIN
and END
instead, like so:
BEGIN;
INSERT INTO dbo.Agencies (code, name) VALUES ( 1, 'My Group');
INSERT INTO dbo.Agencies (code, name) VALUES ( 2, 'Their Group');
END;
and I am still getting the same error. How would this work in Sybase SQL?
Thank you very much.
根据我的评论:删除分号-Sybase不喜欢它们
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.