sqlserver查看死锁记录 怎样查询引起死锁的sql语句?
怎样查询引起死锁的sql语句?
elect 0 ,blocked from (select * from sysprocesses where blocked>0 ) a where not exists(select * from (select * from sysprocesses where blocked>0 ) b where a.blocked=spid) union select spid,blocked from sysprocesses where blocked>0 OPEN s_cur FETCH NEXT FROM s_cur INTO @spid,@bl WHILE @@FETCH_STATUS = 0 begin if @spid =0select " 引起数据库死锁的是: " CAST(@bl AS VARCHAR(10)) " 进程号, 其执行的SQL 语法如下" elseselect " 进程号SPID :" CAST(@spid AS VARCHAR(10)) " 被" " 进程号SPID :" CAST(@bl AS VARCHAR(10)) " 阻塞, 其当前进程执行的SQL 语法如下" DBCC INPUTBUFFER (@bl )
sql server中怎样查询引起死锁的sql语句?
elect0,blockedfrom(select*fromsysprocesseswhereblocked>0)awherenotexists(select*from(select*fromsysprocesseswhereblocked>0)bwherea.blocked=spid)unionselectspid,blockedfromsysprocesseswhereblocked>0OPENs_curFETCHNEXTFROMs_curINTO@spid,@blWHILE@@FETCH_STATUS=0beginif@spid=0select"引起数据库死锁的是:" CAST(@blASVARCHAR(10)) "进程号,其执行的SQL语法如下"elseselect"进程号SPID:" CAST(@spidASVARCHAR(10)) "被" "进程号SPID:" CAST(@blASVARCHAR(10)) "阻塞,其当前进程执行的SQL语法如下"DBCCINPUTBUFFER(@bl)
sqlserver查看死锁记录 sql最简单查死锁 查询数据库死锁语句
版权声明:本文内容由互联网用户自发贡献,本站不承担相关法律责任.如有侵权/违法内容,本站将立刻删除。