Today I got an interesting question from Preethy kammath my colleague.
The question is what is the difference between BEGIN….END VS BEGIN TRAN/COMMIT/ROLLBACK?
The answer is
- BEGIN…END
Begin……End delimits a block of code. IF there is no BEGIN TRAN inside the BEGIN…END then each statement will execute in an autonomous transaction.
- BEGIN TRAN…COMMIT TRAN … Rollback
In this each statement inside this block is executed in the same transaction and cannot be committed or rolled back individually.
Hope every one understood the concept. More discussions are welcome.
My Homepage
14 years ago… [Trackback]…
[…] Informations on that Topic: sqlinfo.in/2010/12/sql-server-trancommitrollback/ […]…
Thirumurugan
14 years agoVery useful information about BEGIN END vs BEGIN TRANS, i looked somewhere but no one give clear info.. thanks varun