Hi Michel. Thanks for your reply.
Do I need Transactions and Isolation level. ? Scenario is as follows, and there could be 20 simultaneous users doing the same thing:
Enter a transaction which needs to update a Customer Balance with a Value of 5. Customer Balance
MUST be updated immediately.
Customer processing pseudo code would be as follows:
1. Read the Current Customer Balance (say its currently = 100)
2. Do a whole pile of processing which say takes 2 seconds for the sake of argument (This bit cannot be avoided)
3. Update the Customer Balance with the Value of 5 (Customer Balance now becomes 100 + 5 = 105)
Now unless I completely LOCK down the Customer Record, User A would have read the Value as being 100, and before User A has finished updating, User B comes along with a transaction value of say 8 reads the Balance also as 100. User A now updates the Customer Balance (100 + 5=105)
User B now comes along and updates the Balance (100 , which User B got , adds 7, = 107) and updates the Balance with 107
This would be incorrect as the balanced should be 100 + 5 = 105 and then 105 + 7 = 112
Other than using a Transaction (which I understand locks the Database) and Isolation Level of Serializable(Which completely locks the row from any updating at all) , I dont know how I can accomplish my task
Is there another way ?