Close Connections
- Code below quickly closes all connections to database.
USE master ALTER DATABASE DBname SET SINGLE_USER WITH ROLLBACK IMMEDIATE -- your code ALTER DATABASE DBname SET MULTI_USER
USE master ALTER DATABASE DBname SET SINGLE_USER WITH ROLLBACK IMMEDIATE -- your code ALTER DATABASE DBname SET MULTI_USER