September 19, 2017

commit and rollback - transaction management in dbms

Data Base management system

commit and rollback

Commit and rollback maintain the integrety of the transaction

try to update a table name value using update query

update tblProduct set qtyavailable = 200 where  productid = 1;

This database query is not a part of any transaction, as soon as you execute the query the change is made premenant to the datbase immediatly.

then if you execute the select query

Select * from tblProduct

you can see the change is effected in database

but in case of transaction

begin transaction
update tblProduct set qtyavailable = 300 where  productid = 1;

the following change will be made in database. but if you


try to establish a new connection , and run the above select query ... you can see "Executing query"

that becase you just begin the transaction, but not commited , the other users cannot see the uncommited database


that is because, sql server default isolation level is read commit data

set transaction isolation level read uncommited;









No comments:

Post a Comment

Your feedback may help others !!!

Facebook comments