Revision: 32275
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 22, 2010 00:05 by samwa
Initial Code
USE master go DECLARE @dbname sysname SET @dbname = 'name of database you want to drop connections from' DECLARE @spid int SELECT @spid = min(spid) from master.dbo.sysprocesses where dbid = db_id(@dbname) WHILE @spid IS NOT NULL BEGIN EXECUTE ('KILL ' + @spid) SELECT @spid = min(spid) from master.dbo.sysprocesses where dbid = db_id(@dbname) AND spid > @spid END
Initial URL
http://www.julian-kuiters.id.au/article.php/sql-server-2005-snippet-drop-db-conn
Initial Description
Initial Title
Drop all connections to a sql 2005 database
Initial Tags
sql
Initial Language
SQL