General information
Category:
Coding, syntax and commands
Title:
Multi User Locking in Sql selects
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only