If you want to make a change in more than one session database at the same time, the control to prevent sessions from adversely affecting each other is called Concurrency Control.
To better understand Concurrency Control, you may want to read the article entitled “SQL Server Lock Types“.
There are two types of Concurrency Control:
|Pessimistic Concurrency Control||In the pessimistic pessimistic concurrency control, when a user wants to change a record, it puts a lock on the record and any other session can not change that record.
The first session changes the record, and then the lock on the record is opened. and others who want to change can now be changed.
|Optimistic Concurrency Control||In the optimistic concurrency control, It is assumed that a record at the same time will not be updated. and multiple sessions can be accessed to update the same record.
If the same record is updated by more than one person, one of the records is canceled and the user is informed that it is canceled.