Set database from SINGLE USER mode to MULTI USER
The “user is currently connected to it” might be SQL Server Management Studio window itself. Try selecting the master database and running the
ALTER query again.
That error message generally means there are other processes connected to the DB. Try running this to see which are connected:
That will return you the process and then you should be able to run:
Where [xxx] is the
spid of the process you're trying to kill.
Then you can run your above statement.
You can add the option to rollback your change immediately.
ALTER DATABASE BARDABARD SET MULTI_USER WITH ROLLBACK IMMEDIATE GO