To check locks in the database, you can use the in-built stored procedure sp_lock
:
Syntax :
sp_lock [ [ @spid1 = ] 'session ID1' ] [ , [@spid2 = ] 'session ID2' ]
[ ; ]
Example : To list all the locks currently held in an instance of the Database Engine, use the following command :
USE SampleDB;
GO
EXEC sp_lock;
GO ​