Reputation: 1835
The situation is : I have a few dedicated clients (terminals) and one database, the operations perform in the following order :
How to resolve it better ? Is there is some solution in MS SQL server ?
Upvotes: 0
Views: 98
Reputation: 38367
Optimistic concurrency is used to detect this collision, which sounds like you are able to detect it already.
Usually you take one of two approaches, last in wins where you always overwrite changes, or first in wins where the second write will fail.
If you fail the second write, then you usually display a message to the user that data has changed and their changes will be lost, then you refresh the data.
Another option is to show them their current edits and then also show them the data after refreshing it(the first saved edits), and letting them choose whether they want to overwrite the changes.
This process is called conflict resolution, and the approach you take depends on who your users are and the business rules regarding the data in question.
Upvotes: 1