Skip to content

Instantly share code, notes, and snippets.

@Toscan0
Last active January 18, 2023 14:22
Show Gist options
  • Save Toscan0/dbc5078e234587b0d8acdd1fe735331c to your computer and use it in GitHub Desktop.
Save Toscan0/dbc5078e234587b0d8acdd1fe735331c to your computer and use it in GitHub Desktop.
Get locked tables in SQL Server
USE [yourdatabase];
GO
SELECT *
FROM sys.dm_tran_locks
WHERE 1=1
AND resource_database_id = DB_ID()
AND resource_associated_entity_id = OBJECT_ID(N'dbo.yourtablename');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment