sys.sp_lock
splock reports information about locks.
What changes
- Input
- Not stated in the Microsoft summary.
- Output or change
- Not stated in the Microsoft summary.
Syntax at a glance
sys.sp_lock
[ [ @spid1 = ] spid1 ]
[ , [ @spid2 = ] spid2 ]
[ ; ]
Work example
splock reports information about locks.
Read the warning and prerequisites. Describe the supported maintenance context without running the procedure.
Check your work Inspects locks for the current session. It does not acquire or release locks. Microsoft marks this procedure as deprecated.
Practice SQL
Open in SQL FlowOpen the SQL for a walkthrough. Run the example in SQL Server to check its result.
DECLARE @current_spid int = @@SPID; EXEC master.sys.sp_lock @spid1 = @current_spid;
Open Microsoft Learn for full syntax, permissions, and details for your version.