If 2 users connect to Access and run query that check the last number, increase this number and insert a record into the database.
Who gets the priority?
Why do I see two duplicate records with the same number?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Neither of them got “priority”. That is no longer a useful term when you talk about non-atomic operations. An example will illustrate the issue here.
Here’s what your script looks like:
This works when only one person uses the database at a time. When more than one person does, things won’t work. Here’s what happens now:
This is called a race condition, and it happens because you didn’t use a transaction. With a transaction, here’s what might happen instead: