Hi,
I have a situation where there is one record in database table i.e. 'abcde'. And User 'X','Y' and "Z' tries to update that record at the same time.
'X' modify abcde to abcdd
'Y' modify abcde to abddd
'Z' modify abcde to abeee
All changes should persist in database table.
Is it possible than please provide the solution.
Thanks in advance
Ck. Nitin

Leon PuthPosted May 20, 2014, 4:41 AM
depending on how you make the data available to your users, the last user to submit changes will possibly undo previous user's changes. if possible your save should only update to database the changed value, and not the entire record, in other word if user views column a,b and c, but only changes b, you should only submit column b changes to the database. if any users changes your key value, it becomes even more difficult to track other concurrent changes.
you could also sit with sql deadlocks, so read up on WITH (NOLOCK) statement, but be careful, you could lose changes altogether.
another aspect you may consider is to notify all users who is viewing the affected record if an update has occurred, but this is very dependent on the architecture of your application.
if however you want all 3 changes to be stored in SEPERATE records, then you need a timestamp or user id column in your table which (may) becomes part of your key, and a sql MERGE statement will make it easy to determine which records to update and which to store
please elaborate on your question and i will be more specific re the solution
Jignesh TrivediPosted May 20, 2014, 1:36 AM
Hi,
I think this type of Concurrency can be maintain by using timestamp column.
Please refer
http://www.primedigit.com/implementing-optimistic-concurrency-with-sql-timestamps/
http://www.codeproject.com/Articles/4811/ASP-NET-Optimistic-Concurrency-Control
hope this will help you.
Anupam SinghPosted May 20, 2014, 12:51 AM
Finally you will get only 1 record ,which updated in last.
read this http://social.msdn.microsoft.com/forums/wpapps/en-us/efaebd75-4196-47d8-b719-7ec7b7965309/how-sql-server-manage-if-many-client-try-to-select-insert-update-in-the-same-table-same-column
hope will help.