Skip to main content
Question

How to task kill the database connection through the cmd prompt

  • February 13, 2024
  • 1 reply
  • 115 views

Forum|alt.badge.img+2

How to task kill the database connection through the cmd prompt.

1 reply

Tamil Arasu10
Most Valuable Pathfinder
Forum|alt.badge.img+18
  • Most Valuable Pathfinder
  • February 19, 2024

Hi @Samadhan,

You can use the sqlcmd utility.

sqlcmd -S [server_name] -U [username] -P [password] -Q "KILL [spid]"

 

Replace [server_name] with your SQL Server name, [username] with your SQL Server username, [password] with your SQL Server password, and [spid] with the session ID (SPID) of the connection you want to terminate.