Wednesday, October 1, 2014

How do you kill all current connections to a SQL Server database

-- set your current connection to use master otherwise you might get an error
USE master
GO
ALTER DATABASE YourDatabase SET SINGLE_USER WITH ROLLBACK IMMEDIATE 
GO
ALTER DATABASE YourDatabase SET MULTI_USER
GO

No comments:

Post a Comment