No tags yet.




  • Facebook - Black Circle
  • Twitter - Black Circle
  • Instagram - Black Circle
  • LinkedIn - Black Circle

Script to Kill Blocked Processes

You might be turning the gun on yourself if you ever have to implement this.

Disclaimer: I would never suggest running this in a production environment without good reason. I was asked to come up with something that will automatically kill blocked processes until the developers could figure out how to fix it (despite my suggestions for performance tuning).

I wrote a simple stored procedure and it was placed into a job that ran continually. You can, of course, modify the query to be more specific like kill only SPIDS for a certain database, or user, or hostname etc...

Also, it might be a good idea to add in some error handling and logging.

#TSQL #scripts #sqlserver #storedprocs