In SQL Server, the sp_lock
stored procedure was used in older versions to display information about locks that were currently being held by processes.
SELECT *
FROM sys.dm_exec_requests;
SELECT *
FROM sys.dm_os_waiting_tasks;
EXEC sp_who2;
DECLARE @sqltext VARBINARY(128)
SELECT @sqltext = sql_handle
FROM sys.sysprocesses
WHERE spid = 322
SELECT TEXT
FROM sys.dm_exec_sql_text(@sqltext)