Skip to main content
Question

How to task kill the database connection through the cmd prompt

  • 13 February 2024
  • 1 reply
  • 57 views

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

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.

 

 

Reply