Created
March 14, 2019 09:55
-
-
Save kshimi/44f1943e2ad74053683a5ad9094bb5a1 to your computer and use it in GitHub Desktop.
SQLServer check lock status
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
resource_type AS type | |
,resource_associated_entity_id as entity_id | |
,( CASE WHEN resource_type = 'OBJECT' THEN | |
OBJECT_NAME( resource_associated_entity_id ) | |
ELSE | |
( SELECT | |
OBJECT_NAME( OBJECT_ID ) | |
FROM | |
sys.partitions | |
WHERE | |
hobt_id=resource_associated_entity_id ) | |
END) | |
AS object_name | |
,request_mode AS request_mode | |
,request_type AS request_type | |
,request_status AS request_status | |
,request_session_id AS session_id | |
FROM | |
sys.dm_tran_locks | |
WHERE | |
resource_type <> 'DATABASE' | |
ORDER BY | |
request_session_id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment