यदि आपका मतलब एक समवर्ती सुरक्षित कतार प्रकार लॉकिंग है, तो ROWLOCK, UPDLOCK, READPAST संकेतों का उपयोग करें?
SQL सर्वर प्रोसेस क्यू रेस कंडीशन
BEGIN TRAN
SELECT TOP 1 @QueryID = [ID] from Table WITH (ROWLOCK, UPDLOCK, READPAST)
UPDATE Table SET [Read] = 1 WHERE [ID] = @QueryID
COMMIT TRAN -- TRAM
हालाँकि, एक बयान में। कुछ ऐसा
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;