About 1,360,000 results
Open links in new tab
  1. sql - How to drop a database when it's currently in use ... - Stack ...

    Nov 24, 2015 · Try below code. USE master; ALTER DATABASE [Duck] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; DROP DATABASE [Duck] ; For deep discussion see this answer.

  2. SQL Server tells me database is in use but it isn't

    Feb 24, 2011 · SQL Server keeps telling me a database is in use when I try to drop it or restore it, but when I run this metadata query: select * from sys.sysprocesses where dbid in (select database_id from ...

  3. Cannot drop database because it is currently in use

    Sep 19, 2011 · You cannot drop a database currently being used however you can use sp_detach_db stored procedure if you want to remove a database from the server without deleting the database files.

  4. SQL Server Cannot drop database <dbname> because it is currently in use ...

    Apr 27, 2011 · When I try to drop a database I get the error "Cannot drop database "dbname" because it is currently in use". However, when I run sp_who2, there are definitely no sessions connected to this database. I've also set the database to single_user mode with rollback immediate. Why is this happening?

  5. How to force a drop of MSSQL Server database

    I am trying to delete an MSSQL Server database, however I am having no luck. I have tried multiple things such as user ALTER DATABASE my_database SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE; GO DROP DATABASE my_database; GO I …

  6. SQL SERVER – FIX – Error 3702, Level 16, State 3 - Cannot Drop Database

    Jun 5, 2015 · Cannot drop database “DemoDB” because it is currently in use. The meaning of the error message is pretty clear that someone is using the database and it can’t be deleted/dropped. First, make sure that it is not our own connection. To make sure, always change the context before dropping the database as shown below USE MASTER GO DROP ...

  7. sql server - Can't Delete Database - Database Administrators …

    Mar 3, 2017 · SQL Server leaves them on the disks if the database was OFFLINE when you deleted the database. If you have SQL Server 2016 or greater you can use DROP DATABASE IF EXISTS. https://learn.microsoft.com/en-us/sql/t-sql/statements/drop-database-transact-sql?view=sql-server-2017.

  8. SQL Server Can’t Drop Database in Use – Fix Error 3702

    Nov 18, 2024 · SQl DB Error 3702 Cannot drop the database because it is currently in use is a common SQL Server issue. Learn to fix SQL Server can't drop database in use safely.

  9. Cannot drop database because it is currently in use - makolyte

    Mar 9, 2021 · When you try to drop the database, you get the following error and the drop fails: Cannot drop database because it is currently in use. This means there are other open connections on the database and it won’t let you drop the database.

  10. Cannot drop database because currently in use - SQL Server Error

    Jul 14, 2023 · To fix the error 3702 cannot drop the database because it is currently in use with SQL Server, check and close all the active connections.