How is it possible to make such scenario:
I have table with Order objects. There are many orders in DB. There is mechanism with few threads that can get the next order from DB (but need locks, that same order won't be executed few times).
How is it possible in SQL Server level to make that one thread reads the row (order), deletes it from DB and returns it to C# written mechanism which executes it, when other thread can see the row is locked, it skips that row and takes the next one?
The orders have execution priority and clustered index is on priority column.
This stuff will be executed in stored procedure.