System procedures that are not allowed in transactions  Rolling back and saving transactions

Chapter 20: Transactions: Maintaining Data Consistency and Recovery

Beginning and committing transactions

The begin transaction and commit transaction commands can enclose any number of SQL statements and stored procedures. The syntax for both statements is:

begin {transaction | tran} [transaction_name]
commit {transaction | tran | work} [transaction_name]

transaction_name is the name assigned to the transaction. It must conform to the rules for identifiers.

The keywords transaction, tran, and work (in commit transaction) are synonymous; you can use one in the place of the others. However, transaction and tran are Transact-SQL extensions; only work is SQL-standards-compliant.

Here is a skeletal example:

begin tran 
    statement 
    procedure 
    statement
commit tran

commit transaction does not affect Adaptive Server if the transaction is not currently active.





Copyright © 2005. Sybase Inc. All rights reserved. Rolling back and saving transactions

View this book as PDF