Next / Previous / Index / ITC Help System / Publications / Site map / NM Tech homepage

Sybase transactions: preventing lost data

Tech Computer Center logo

We've all done it, haven't we? You'll be typing, and suddenly you'll hit the wrong key and press Enter, and before you know it, all your files are gone (or you sent a love note to your mother instead of your squeeze, or you accidently overwrote an important file with your grocery list). Well, the folks that created SQL realized that, and they gave us a way to save ourselves from ourselves: transactions.

Transactions allow you to type a command, and then undo it if it's incorrect, just like you might do in your wordprocessor. If you are going to do a dangerous action, something that might destroy your data, put it inside a transaction just to be safe. If it works okay, you can commit your changes to the database. Until you commit the changes, your database isn't changed.

Note: You can only do certain kinds of operations called ``atomic'' operations in a transaction. If you try to do a non-atomic operation, you'll get an error message like:

        Msg 2762, Level 16, State 4
        Server '', Line 1
        The 'DROP TABLE' command is not allowed within a
           multi-statement transaction in the 'pubs2' database.

Next: Using multiple databases in Sybase
See also: Using the Sybase database system
Previous: Searching Sybase databases
Site map
Index: Keyword index to help pages
Help: New Mexico Tech Information Technology and Communications: Help System
ITC Publications
To report a problem: File a ticket
Send mail to the User consultant on duty or call them at 575-835-5437
Home: About New Mexico Tech

Maintained by John Shipman,; original by Steve Anderson
Last updated: 1997/06/25 19:51:27 UT
QR two-dimensional bar code