Transaction Management in SQL server


Abstract :

              In this  article we learn Transaction Management in SQL server database 2008.

Agenda :

1) What is transaction Management ?
2) Purpose of  transaction Management ?
3) Command in transaction  management  ?

Lets learn in details.

What is transaction ?

                                  Transaction can be define  “it is series of changes made to one or more tables in database “.

 Purpose of   transaction Management ?

                   Transaction  Management has following two important purpose

1)Implementing Atomicity i.e. either all the changes in the transaction made perment or neither changes.
2)to cancel  all the changes made to tables.

Command in  transaction Management ?

Following command are used for transaction management

1)Begin Transaction:
    This command is used to create a transaction when you create transaction and then made any changes to tables then the changes will not be to table directly and also the changes you made to tables will not be visible to any other user until the transaction end.

2)Commit Transaction:
                           This command is used to make all the changes in the current transaction perment and end of transaction.

3)Rollback Transaction :
                   This command is used to make all the changes in current transaction cancel it and the end of transaction.
Demo:
In this demonstration we  first  insert record in table tbl_Employee using transaction. here we are used command commit transaction so it is permently saved to database. but when we are update the same record but here we are used rollback transaction ,Rollback cancel the current transaction. so when we get the details using select command then it show that record is not updated it indicated that commit saved permently to  database and rollback cancel current transaction.
     Hope you understand clearly.

Conclusion:
         Hence  we learn Role of log file in Transaction Management in SQL Server 2008.

If you have any query regarding same feel free to  left mail to me dotnetbyabhipatil@gmail.com  or visit my blog http://dotnetbyabhipatil.blogspot.in





Previous
Next Post »