Monday, 25 February 2013

transaction


TRANSACTION:

 A transaction can be defined as a sequence of operations performed together as single logical unit of work.
a single unit of work must possess the following properties called ACID(Atomicity,Consistency,Isolation,Durability)


1.Atomicity:
------------
  this states that either all the data modifications are performed or none of them are performed.

2.Consistency:
--------------
this states that all the data is in a consistent state after the all the transaction is completed successfully

3.ISOLATION:
------------
This  states that any data modification made by concurrent transactions must be isolated from modifications made by other

 concurent transactions.


4.DURABILITY:
-------------
This states that any change in data by a completed transaction remains permanently in effect in the system.
therefore ,any change in the data due to a completed transaction persists even in the event of the system failure








Transactions:
------------
Transactions group a set of tasks into a single execution unit. Each transaction begins with a specific task and ends when all the tasks in the group successfully
complete. If any of the tasks fails, the transaction fails. Therefore, a transaction has only two results: success or failure. Incomplete steps result in the
failure of the transaction.

Users can group two or more Transact-SQL statements into a single transaction using the following statements:

1.Begin Transaction
2.Rollback Transaction
3.Commit Transaction
4.Save transaction

If anything goes wrong with any of the grouped statements, all changes need to be aborted.
The process of reversing changes is called rollback in SQL Server terminology.
If everything is in order with all statements within a single transaction, all changes are recorded together in the database.
In SQL Server terminology, we say that these changes are committed to the database.

1.Begin Transaction:
--------------------
Is used to set the starting point of transaction.

2.Rollback Transaction
----------------------
is used to undo the changes

3.Commit Transaction
--------------------
is used to save the changes

4.4.Save transaction
--------------------

IS USED to establish save points that allow partial rollback of a transaction.






No comments:

Post a Comment