EnumLocks Method (SQL-DMO)

The EnumLocks method returns a QueryResults object enumerating the resource locks held by a Microsoft® SQL Server™ installation.

Applies To
Database Object SQLServer Object

Syntax

object.EnumLocks( [ Who ] ) as QueryResults

Part Description
object Expression that evaluates to an object in the Applies To list
Who Optionally restricts output by process identifier

Returns

A QueryResults object containing one result set defined by these columns.

Column Data type Description
req_spid integer Process ID of the process requesting the lock.
locktype nvarchar(36) A text description of a locking mode. For more information about interpreting values, see the description of the system table syslockinfo column req_mode.
tablename nvarchar(129) If applicable, the name of the table against which the lock is applied.
indexname nvarchar(129) If applicable, the name of the index against which the lock is applied.
dbname nvarchar(129) Name of the database in which the locked resource is defined.
status tinyint An integer indicating lock application status. For more information about interpreting values, see the description of the system table syslockinfo column req_status.

Remarks

When restricting the QueryResults object content by using the Who argument, use the process ID identifying the login or other process targeted. The EnumProcesses method can be used to help identify a target process.

Prototype (C/C++)

HRESULT EnumLocks(
LPSQLDMOQUERYRESULTS* ppResults,
long Who = -1);

See Also
EnumProcesses Method syslockinfo

 

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.