Transactions and insert

When you set chained transaction mode, the SAP ASE server implicitly begins a transaction with the insert statement if no transaction is currently active. To complete any inserts, you must commit the transaction, or roll back the changes.

For example:
insert stores (stor_id, stor_name, city, state)
  values ('999', 'Books-R-Us', 'Fremont', 'AZ')
if exists (select t1.city 
  from stores t1, stores t2 
  where t1.city = t2.city 
  and t1.state = t2.state 
  and t1.stor_id < t2.stor_id)
    rollback transaction
else
    commit transaction

In chained transaction mode, this batch begins a transaction and inserts a new row into the stores table. If it inserts a row containing the same city and state information as another store in the table, it rolls back the changes to stores and ends the transaction. Otherwise, it commits the insertions and ends the transaction. For more information about chained transaction mode, see the Transact-SQL User’s Guide.