Terminate (kill) specific session on a server

SQL Server provides command to kill specific session on a server.

Find session ID

First we will identify the session we want to end. We do it by listing all sessions on the server with this query:

exec sp_who

Result

Result shows active sessions on server and three of them are from my computer - LS-MICHALWROBEL:

sample results

Kill session

Now we will use session ID (spid) to kill the session (67 in our example):

kill 67

Result

SQL Sevrer ends session and rolls back all transactions that are associated with it. This operation can take a while.

Command(s) completed successfully.
0
There are no comments. Click here to write the first comment.