Den slags tilgang, jeg vil anbefale, er at have et felt i posten på linje med, der angiver, om posten behandles eller ej. Implementer derefter en "læs næste fra køen"-sproc, der gør følgende for at sikre, at ingen 2 processer opfanger den samme post:
BEGIN TRANSACTION
-- Find the next available record that's not already being processed.
-- The combination of UPDLOCK and READPAST hints makes sure 2 processes don't
-- grab the same record, and that processes don't block each other.
SELECT TOP 1 @ID = ID
FROM YourTable WITH (UPDLOCK, READPAST)
WHERE BeingProcessed = 0
-- If we've found a record, set it's status to "being processed"
IF (@ID IS NOT NULL)
UPDATE YourTable SET BeingProcessed = 1 WHERE ID = @ID
COMMIT TRANSACTION
-- Finally return the record we've picked up
IF (@ID IS NOT NULL)
SELECT * FROM YourTable WHERE ID = @ID
For mere information om disse tabeltip, se MSDN