If u set the DB to single user mode it ll terminate all the connections.or try thisCREATE PROCEDURE usp_killDBConnections @DBName varchar(50), @withmsg bit=1ASSET NOCOUNT ONDECLARE @spidstr varchar(8000)DECLARE @ConnKilled smallintSET @ConnKilled=0SET @spidstr = ''IF db_id(@DBName) < 4 BEGIN PRINT 'Connections to system databases cannot be killed' RETURNENDSELECT @spidstr=coalesce(@spidstr,',' )+'kill '+convert(varchar, spid)+ '; 'FROM master..sysprocesses WHERE dbid=db_id(@DBName)IF LEN(@spidstr) > 0 BEGIN EXEC(@spidstr) SELECT @ConnKilled = COUNT(1) FROM master..sysprocesses WHERE dbid=db_id(@DBName) ENDIF @withmsg =1 PRINT CONVERT(VARCHAR(10), @ConnKilled) + ' Connection(s) killed for DB ' + @DBNameGO
"There is only one difference between a dream and an aim.A dream requires soundless sleep to see,whereas an aim requires sleepless efforts to achieve..!!"