Best Way to Determine if a Table has a Long Running Transaction
4
votes
2
answers
596
views
I need to be able to iterate all tables and issue a
TRUNCATE
command, however, I don't want the loop to be held up by blocking. Essentially, I am looking for the best way to determine if a SCH-M
lock can be obtained prior to issuing a truncate command.
>Microsoft SQL Server 2019 (RTM-CU26) - 15.0.4365.2 (X64) Standard Edition (64-bit) on Windows Server 2016 Datacenter 10.0
Asked by Ross Bush
(683 rep)
Jul 9, 2024, 01:13 PM
Last activity: Jul 11, 2024, 09:39 PM
Last activity: Jul 11, 2024, 09:39 PM