Session Ready
Exercise

Doomed transactions

You want to insert the data of two new customers into the customer table. You prepare a script controlling that if an error occurs, the transaction rollbacks and you get the message of the error. You want to control it using XACT_ABORT in combination with XACT_STATE.

Instructions
100 XP
  • Use the appropriate setting of XACT_ABORT.
  • Check if there is an open transaction.
  • Rollback the transaction.
  • Select the error message.