Check Locked Tables


Below is the query by which you can check if the table is locked or not


select distinct object_name(a.rsc_objid), a.req_spid, b.loginame
from master.dbo.syslockinfo a (nolock) join
master.dbo.sysprocesses b (nolock) on a.req_spid=b.spid
where object_name(a.rsc_objid) is not null
and a.rsc_objid = OBJECT_ID('TableName')

No comments:

Post a Comment