Thursday, 22 November 2018

MSSQL - Fix Error - Cannot drop database "CompanyBackup" because it is currently in use.



Msg 3702, Level 16, State 3, Line 1
Cannot drop database "CompanyBackup" because it is currently in use.



watch solution on YouTube


To fix it replace

Drop Database Test
Go

with 

Exec msdb.dbo.sp_delete_database_backuphistory @database_name = N'test'
Go
Use [master]
go
Alter Database Test Set Single_User with Rollback Immediate
Go
Drop Database Test
Go

No comments:

Post a Comment