Use this statement to cancel any changes made since a SAVE TRANSACTION.
ROLLBACK TRANSACTION [ savepoint-name ]
The ROLLBACK TRANSACTION statement undoes any changes that have been made since a savepoint was established using SAVE TRANSACTION. Changes made prior to the SAVE TRANSACTION are not undone; they are still pending.
The savepoint-name is an identifier that was specified on a SAVE TRANSACTION statement within the current transaction. If savepoint-name is omitted, all outstanding changes are rolled back. Any savepoints since the named savepoint are automatically released.
There must be a corresponding SAVE TRANSACTION within the current transaction.
SQL/2003 Vendor extension.
The following example displays five rows with values 10, 20, and so on. The effect of the DELETE, but not the prior INSERTs or UPDATE, is undone by the ROLLBACK TRANSACTION statement.
BEGIN SELECT row_num INTO #tmp FROM sa_rowgenerator( 1, 5 ) UPDATE #tmp SET row_num=row_num*10 SAVE TRANSACTION before_delete DELETE FROM #tmp WHERE row_num >= 3 ROLLBACK TRANSACTION before_delete SELECT * FROM #tmp END
|Discuss this page in DocCommentXchange.
Send feedback about this page using email.
|Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1|