Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

sql server kill all connections

USE [master];

DECLARE @kill varchar(8000) = '';  
SELECT @kill = @kill + 'kill ' + CONVERT(varchar(5), session_id) + ';'  
FROM sys.dm_exec_sessions
WHERE database_id  = db_id('MyDB')

EXEC(@kill);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sql #server #kill #connections
ADD COMMENT
Topic
Name
5+1 =