kill all the connection | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

kill all the connection

Can i kill all the connection to the data base at once?
As far as I know there is no way to automatically kill off all the connections to the database (unless of course you pull the network connection <img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ />).<br /><br />What you can do is query all the SPIDs in the sysprocesses table and kill each one individually using the KILL command.<br />You could put some TSQL together to loop through each record using a cursor and issue the KILL statement on the resulting SPID.<br /><br />Cheers<br />Shaun<br /><br /><br />World Domination Through Superior Software
You can execute (in SQL Server 2000) ALTER DATABASE database SET SINGLE_USER WITH ROLLBACK IMMEDIATE or something similar (e.g. RESTRICTED_USER or OFFLINE) which will change the database’s state and rollback all open transactions, and kick the users out of the database. This is the method used by log shipping to prepare a database in standby mode to have the next transaction log applied, I believe. Tom Pullen
DBA, Oxfam GB
There is a way from EM..
All tasks–>Detach dataBase—>Just hit "Clear" button (Don’t press Ok,otherwise the database will get detached) GSV
As well as all these there is the blatantly obvious one, of just stoping then restarting SQL server. (You can use T-SQL to stop it)
Follow the Tom’s referrence which is reliable one. _________
Satya SKJ

]]>