SQL Server Kill Sessions: Filtered SPID Management
Apr 11, 2026 / · 9 min read · sql server session management kill spid database administration dm exec sessions maintenance scripts sql scripts database connections active sessions open transactions ·Kill SQL Server Sessions with Targeted Filters Using KILL and dm_exec_sessions This article covers a practical T-SQL script that kills one or more SQL Server sessions (SPIDs) while giving you precise control over which sessions are targeted. The script uses sys.dm_exec_sessions to query active sessions and a cursor to …
Read MoreSQL Server Blocking Detection: Find Blocked Sessions
Mar 1, 2026 / · 5 min read · sql server blocking performance dm exec requests dm exec sessions wait types dba scripts monitoring query tuning ·Blocking in SQL Server occurs when one session holds a lock that another session needs, causing the second session to wait. This T-SQL script queries the dynamic management views to show all currently blocked sessions, the blocking session, wait type, wait duration, and the SQL text involved. Purpose and Overview When …
Read More