Si vous voulez dire un verrouillage de type de file d'attente sécurisé pour la concurrence, utilisez les conseils ROWLOCK, UPDLOCK, READPAST ?
Condition de concurrence de file d'attente de processus SQL Server
BEGIN TRAN
SELECT TOP 1 @QueryID = [ID] from Table WITH (ROWLOCK, UPDLOCK, READPAST)
UPDATE Table SET [Read] = 1 WHERE [ID] = @QueryID
COMMIT TRAN -- TRAM
Cependant, dans une déclaration. quelque chose comme
WITH T AS
(
--ORDER BY with TOP , or perhaps MIN is better?
SELECT TOP 1 [Read], [ID] from Table
WITH (ROWLOCK, UPDLOCK, READPAST) ORDER BY [Read]
)
UPDATE
T
SET
[Read] = 1;