20.07.2013 Views

Beginning SQL

Beginning SQL

Beginning SQL

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

SAVE TRANSACTION<br />

Select<br />

Update<br />

Begin<br />

Transaction<br />

Insert<br />

Update<br />

Commit<br />

Transaction<br />

Figure 11-3<br />

Database<br />

Database<br />

Transactions<br />

The SAVE TRANSACTION statement allows you to create named Savepoints that mark points inside of a<br />

large transaction. This allows the ROLLBACK TRANSACTION to perform partial rollbacks by providing a<br />

Savepoint name to the ROLLBACK statement. The SAVE TRANSACTION statement does not perform a save<br />

(that is the function of the COMMIT TRANSACTION statement); rather it simply sets up markers within the<br />

transaction. Figure 11-4 shows a series of <strong>SQL</strong> statements with SAVE TRANSACTION statements inserted<br />

along the way. In this case, a COMMIT is eventually performed, but if required, a ROLLBACK could be performed<br />

back to either of these two named Savepoints.<br />

309

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!