Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
robotinc
Starting Member
1 Post |
Posted - 2002-10-07 : 18:38:09
|
| I'm setting up a table in MSSQL as a queue for multiple servers to select from and process records from the queue. Pretty simple. I'm looking for the best way to make sure that those servers checking the queue never end up processing the same record. |
|
|
AjarnMark
SQL Slashing Gunting Master
3246 Posts |
Posted - 2002-10-07 : 19:10:54
|
| I would add a status field to the queue record that would have probably 3 options: Awaiting Processing, In Process, Complete. You'll probably want to use a transaction to SELECT the next queue Record to be processed, and UPDATE it's status, all the while keeping a lock on it. Once it is updated, you could release the lock. You might also want to put in a column that tracks which server is processing the request.Depending on your needs, you might delete the records after they have been completed, or perhaps insert a copy into a queue_history table after completion. |
 |
|
|
|
|
|