查看被锁表:
sql;">
select spId
from master..SysProcesses
where db_Name(dbID) = '数据库名称'
and spId <> @@SpId
and dbID <> 0
@H_403_7@
解除锁:
sql;">
exec ('Kill '+cast(@spid as varchar))
@H_403_7@
查看被锁表:
sql;">
select request_session_id spid,OBJECT_NAME(resource_associated_entity_id) tableName
from sys.dm_tran_locks where resource_type='OBJECT'
@H_403_7@
spid 锁表进程
tableName 被锁表名