Share on FacebookSometimes you need to clear allt he connections to the database in order to make som changes to it. I guess that there is a lot of way doing this but this one suites me.
USE master;
GO
ALTER DATABASE [databaseName]
SET SINGLE_USER
WITH ROLLBACK IMMEDIATE;
GO
ALTER DATABASE [databaseName]
SET MULTI_USER;
GO
Found it on this site
d295cc46-3b99-4b78-a781-c9445460f9d4|0|.0