"Suppose you receive a call that the particular SQL instance is running slow. You start troubleshooting and identify a SPID causing blocking for other SPID’s, and it is taking many system resources. You require terminating this query to release the high-consuming resources a remove blocking due to this session.
You can use this:
KILL { session ID [ WITH STATUSONLY ] | UOW [ WITH STATUSONLY | COMMIT | ROLLBACK ] } - Ends a user process that is based on the session ID or unit of work (UOW). If the specified session ID or UOW has much work to undo, the KILL statement may take some time to complete. The process takes longer to complete particularly when the process involves rolling back a long transaction.
KILL ends a normal connection, which internally stops the transactions that are associated with the specified session ID. At times, Microsoft Distributed Transaction Coordinator (MS DTC) might be in use. If MS DTC is in use, you can also use the statement to end orphaned and in-doubt distributed transactions.
🔥PLEASE LIKE and SUBSCRIBE🔥 - this will boost our motivation to create even more amazing videos.
Be a SQL HERO!
I know you will use it 🤣 #sql #kill #datascience #process #dataengineering #dataanalytics #sqlserver #data"