Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
PHUser
Starting Member
11 Posts |
Posted - 2010-03-04 : 15:34:59
|
| Can someone explain isolation level serializable?if two processes run the same stored proc,Set transaction isolation level serializablebegin trandeclare @currentnum intSelect @currentnum = currentnum from refnumbers where id = 1;update refnumbers set currentnum = @currentnum where id = 1;commit transo if user1 and user2 run the select query at the same time, does it mean user2 will not be able to select anything until user1 transaction commits? keep in mind user1 has not ran the update yet, both users are running select. |
|
|
namman
Constraint Violating Yak Guru
285 Posts |
Posted - 2010-03-05 : 11:07:35
|
| so if user1 and user2 run the select query at the same time, does it mean user2 will not be able to select anything until user1 transaction commits? keep in mind user1 has not ran the update yet,both users are running select.In that case, user2 will able to select, even the same row (id = 1). As the result, the user1 and user2 may get the same value.The reason is that, before user1 reach update command, both users are granted share (row) locks on table refnumbers. Those locks may impact on others modifying the source, but not reading the source. Isolation Level plays no role in that stage.If you want to prevent user2 to do select while user1 does it work, there are couple ways to play around with that, depend on what your application wants to do. |
 |
|
|
|
|
|
|
|