Do table locks get released after a query finishes when WAITFOR is used after that query within the same batch and transaction?
0
votes
1
answer
807
views
If I have a query that reads from a table, if that query is proceeded with the WAITFOR keyword (within the same batch and transaction) will the table lock of the preceding query be held until the WAITFOR completes and the transaction finishes? (I mean in the context of a Read Committed isolation level server.)
Example query:
BEGIN TRANSACTION
SELECT *
FROM ReallyLargeTable
WAITFOR DELAY '00:30';
COMMIT TRANSACTION
Does the WAITFOR DELAY cause the preceding query to hold its table lock against ReallyLargeTable for an additional 30 seconds until the delay is over and the transaction is committed?
Asked by J.D.
(40903 rep)
Nov 14, 2019, 10:37 PM
Last activity: Nov 14, 2019, 10:49 PM
Last activity: Nov 14, 2019, 10:49 PM