Skip to main content

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