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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-02-26 : 09:11:13
|
| Utpal writes "I have a current stock field in my Item master of a SQL Server 7.0 database. What would happen if the field is updated by two users simultaneously without locking the record (I could use the NOLOCK option of SQL Server) ? E.g. The current stock before updation is 100. The simultaneous updations made are additions to the stock on account of purchase transactions which are 50 and 30. After the simultaneous updation takes place, would the current stock be 180, or it might ignore one of the additions and show 150 or 130 ? Or would anything else go wrong ?" |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2002-02-26 : 09:22:33
|
| It's not possible to do an update without locking the record.If the update isupdate tbl set num = num + 100then you will be ok as this will cause sequential updates.select @num = num from tblset @num = @num + 100update tbl set num = @numwil not work as the same value could be retrieved by two spids.==========================================Cursors are useful if you don't know sql.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|