This seems to be the easiest way to kill all connections (sessions) on a SQL Server database: ALTER DATABASE database_name SET SINGLE_USER WITH ROLLBACK IMMEDIATE After executing the above, it will put the database in single user mode. So you then need to remove single user mode using: EXEC sp_dboption ‘database_name’, ‘single user’, ‘FALSE’ Popular [...]
Archive of entries posted on October 2009
