I need to understand about sql server transaction? I have gone through some articles available on google but I have not understood anything. Can anyone help me?
+1
A:
You can explicitly start a transaction by writing BEGIN TRANSACTION
. You end the transaction by running COMMIT TRANSACTION
.
Before the COMMIT
is run, the tables affected by your query can still be rolled back to the state they were in at the BEGIN TRANSACTION
point-in-time.
This is useful when you are writing a stored procedure that is pumping a lot of data between tables. By dividing it in smaller parts using transactions, the whole bunch does not need to be "rolled back" when the procedure hangs, an error occurs or you cancel it manually.
An article that elaborates on this is for example this one.
littlegreen
2010-10-12 10:50:23