KanasanRamalingam
asked on
MS-SQL Lock Issues
I created one table with 5 row inserted and index.Now I open two
session(i.e Query analyzer) In First session I start begin transaction and updating 2
rows out of 5 rows but not giving rollback or commit transaction In second session I
am tring to select all records (i.e 5 rows{select * from object}) it is not
responding I come back to first session and apply rollback transaction.Now in second
session record is visible.
Basically I am expecting output in second session is, the two rows which are updated
with old value because it is not commited(like Oracle) and remaining 3 rows which are
not touch by any one.
What I did:- I tried to set isolation level to both session as read commited(I think
it is default but I set it) SET TRANSACTION ISOLATION LEVEL READ COMMITTED GO DBCC
USEROPTIONS GO still second session not showing any think until rollback or commit in
first session. After this I used:- exec sp_indexoption
'Object','DisAllowPageLock s',true exec sp_indexoption 'Object','AllowRowLocks',t rue
exec sp_tableoption 'Object','table lock on bulk load',false
again second session is not repling back.
How do I solve this problem in Sequel?
session(i.e Query analyzer) In First session I start begin transaction and updating 2
rows out of 5 rows but not giving rollback or commit transaction In second session I
am tring to select all records (i.e 5 rows{select * from object}) it is not
responding I come back to first session and apply rollback transaction.Now in second
session record is visible.
Basically I am expecting output in second session is, the two rows which are updated
with old value because it is not commited(like Oracle) and remaining 3 rows which are
not touch by any one.
What I did:- I tried to set isolation level to both session as read commited(I think
it is default but I set it) SET TRANSACTION ISOLATION LEVEL READ COMMITTED GO DBCC
USEROPTIONS GO still second session not showing any think until rollback or commit in
first session. After this I used:- exec sp_indexoption
'Object','DisAllowPageLock
exec sp_tableoption 'Object','table lock on bulk load',false
again second session is not repling back.
How do I solve this problem in Sequel?
ASKER
Hi angellll,
Thank you very much for your comments.
According to your method I'll get the dirty data from the Session 1. Which is very dangerous data.
I would like to have the committed data from the table while the transaction in session 1 is on process.
Thank you very much for your comments.
According to your method I'll get the dirty data from the Session 1. Which is very dangerous data.
I would like to have the committed data from the table while the transaction in session 1 is on process.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
KanasanRamalingam:
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
By either setting this:
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
or using
SELECT * FROM yourtable (NOLOCK)
you will be able to read the rows with the current values.
CHeers