Share via


EnumLocks Method

この機能は、将来のバージョンの Microsoft SQL Server では削除される予定です。新規の開発作業ではこの機能を使用しないようにし、現在この機能を使用しているアプリケーションは修正することを検討してください。

The EnumLocks method returns a QueryResults object that enumerates the resource locks held by an instance of Microsoft SQL Server.

構文

object
.EnumLocks( [ Who ] )as QueryResults

Parts

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

Prototype (C/C++)

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

Returns

A QueryResults object that contains one result set defined by these columns.

Column Data type Description

dbname

nvarchar(129)

Name of the database in which the locked resource is defined.

indexname

nvarchar(129)

If applicable, the name of the index against which the lock is applied.

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.

req_spid

integer

Process ID of the process requesting the lock.

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.

tablename

nvarchar(129)

If applicable, the name of the table against which the lock is applied.

解説

When restricting the QueryResults object content using the Who argument, use the process ID that identifies the login or other process targeted. The EnumProcesses method can help identify a target process.

Applies To:

Database Object

SQLServer Object

参照

関連項目

EnumProcesses Method

その他の技術情報

sys.syslockinfo (Transact-SQL)

ヘルプおよび情報

SQL Server 2005 の参考資料の入手