By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,379 Members | 1,404 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,379 IT Pros & Developers. It's quick & easy.

COMMIT & ROLLBACK

P: 7
hi all,

can anybody tell me the difference between COMMIT and ROLLBACK statements in sql??
thanks in advance
Apr 29 '08 #1
Share this Question
Share on Google+
3 Replies


Delerna
Expert 100+
P: 1,134
In very basic terms they are both used in conjunction with
BEGIN TRANS

after you complete a transacion you are meant to perform a test and if all is ok then you COMMIT the transaction. The transaction is now complete and can't be undone easily.

If however something went wrong then you ROLLBACK the transaction and everything will be returned to the state it was in before you BEGIN TRANSACTION
does that make sense?
Apr 30 '08 #2

ck9663
Expert 2.5K+
P: 2,878
Well said Delerna. In addition, ROLLBACK returns to the previous state of the data, NOT the program flow.

-- CK
Apr 30 '08 #3

P: 1
Commit : if specifies the commit all the rows updated till that point are permently save in the database, only if the program successfully execute their will be auto commit.

Rollback : if specifies the rollback, whatever rows updated by the program are reverted or undone. when the program unsuccessfully execute the system will be auto rollback.
Nov 7 '11 #4

Post your reply

Sign in to post your reply or Sign up for a free account.