--检查SQLServer 锁情况
create table #test(
spid smallint,
dbid smallint,
ObjId int ,
IndId smallint ,
type nchar(4) ,
Resource nchar(16),
Mode nvarchar(8) ,
Status nvarchar(8)
)
insert into #test exec sp_lockselect b.name, a.*
from #test a, sysobjects b
where a.objid=b.id and b.type='U'
drop table #test
本文提供了一个SQLServer锁检查的方法,通过创建临时表并使用sp_lock存储过程来收集锁信息,之后与sysobjects表联接以获取用户表名称,最终显示会话ID、数据库ID、对象ID等关键字段。
176





