script to find deadlocks in sql server code example Example: t sql check active deadlock select * from sys.sysprocesses where blocked > 0