Monday, 14 February 2011

SQL Query to find Who is Blocking database

Simple Script to get Blocking Info in SQL Server Database:


select * from
(select spID, blocked, program_name, loginame from sys.sysprocesses (nolock) where blocked <> 0) locks,
(select spID, blocked, program_name, loginame from sys.sysprocesses (nolock)) allprocess
where locks.blocked = allprocess.spId

No comments:

Post a Comment