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 |
|
aex
Yak Posting Veteran
60 Posts |
Posted - 2007-06-05 : 00:19:35
|
| Hi, i try to lock a table row being read, and release the lock only after the read and other operation is done. Do any one have any idea on how to do this?Thanks for any reply.aex |
|
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2007-06-05 : 01:21:19
|
sql server does this for you automatically, as long as you are not specifying the NOLOCK hint or using the READ UNCOMMITED transaction isolation level. You don't have to worry about this in your code. www.elsasoft.org |
 |
|
|
aex
Yak Posting Veteran
60 Posts |
Posted - 2007-06-05 : 06:22:50
|
| Thank jezemine for the reply. So do you mean that the row will be locked exclusively before the lock is released?aex |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-06-05 : 06:26:36
|
| No. A shared lock will be placed so that the row can also be viewed by other users as well.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2007-06-05 : 09:26:08
|
only writers take exclusive locks. readers take shared locks. shared locks can be shared with other readers, but not writers. writes must wait until all shared locks are released, then they take an exclusive lock. elsasoft.org |
 |
|
|
|
|
|