SQL Flow Field Guide

sys.sp_lock

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

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 Flow

Open 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.