Lets say I have 10 records in the table.
- Id Name
- 1 abc
- 2 def
- 3 ghi
- 10 xyz
Now there will be multiple request from multiple concurrent request to this SQL table with select top 1 record from this table.
- When First request comes with Select TOP 1 record the first record should be returned and locked for others to update
- When the Second request comes with select TOP 1 record, the next record should be locked and returned
- When the Third request comes with select TOP 1 record, the 3rdrecord should be locked and returned
- When the 10th request comes with select TOP 1 record, the 10th record should be locked and returned
Is there any way to perform this kind of operation?