Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Multi User Locking in Sql selects
Message
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Multi User Locking in Sql selects
Miscellaneous
Thread ID:
01516987
Message ID:
01516987
Views:
90
I have following scenario and wonder how to handle it in Sql (In VFP I would have used FLOCK)

Inventory Balance = 100

User A Selects Out from Inventory Table
Uses the 100, Does 'stuff' with Inventory Balance whcih Takes 5 Minutes, and needs to add 5 to the 'Curent ' Balance
(If I use a Sql Update Balance woukd be changed to 105 (100 + 5)

User B Selects out from Inventory Table at same time as user A (Balance= 100)
Uses the 100, Does 'stuff' with Inventory which Takes 7 Minutes, and needs to add 7 to the Balance () (whatever it happens to be now
(If I use a Sql Update , Balance would be changed to 107 (100 + 7)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------

What I really want the new balance to be is 100 + 5(User A) + 7 (User B) i.e. 112

Do I still use some form of Locking or is there 'some other way' to do this in SQL

Many thanks in Advance
Gerard
Next
Reply
Map
View

Click here to load this message in the networking platform