Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Multi User Locking in Sql selects
Message
From
01/07/2011 12:19:07
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01516987
Message ID:
01517061
Views:
47
>>Is there a Sql Command like---> Update Inventory Set Balance = Balance +5
which replaces whatever Balance is in Sql with the Balance + 5
If there is, I think that would work fine

Yes, there is.


I add a field to all the SQL Tables called lckstat char(1) and lckuser char(4).
When someone grabs a row for update, I set lckstat to 'L' and clear if when finished.

If it has 'L' in when user B goes for, I tell them that user A has it locked.



>>Hi Viv, thanks for replying.

....User A : Update Inventory Set Balance = Balance +5
....User B: Update Inventory Set Balance = Balance +7

Is there a Sql Command like---> Update Inventory Set Balance = Balance +5
which replaces whatever Balance is in Sql with the Balance + 5
If there is, I think that would work fine

I have only ever used a sSql Update as:
Update Inventroy Set Balance = X which replaces the Balance with X

But in my Case, Say I am User B, when i Initially took the Balance it was 100, and now I am replacing it with 100 + 7
but User A has already increased it to 100 + 5 = 105

Regards,
Gerard
Anyone who does not go overboard- deserves to.
Malcolm Forbes, Sr.
Previous
Reply
Map
View

Click here to load this message in the networking platform