Category: SQL Server
view more software Tips and Tricks
Updated: 10/17/2011 08:10 AM
Author: Shiju Mathews
When we are running drop database command on an existing table that is under usage, We will get error
“Msg 3702, Level 16, State 4, Line 2
Cannot drop database "CourtesyIndiaDB" because it is currently in use.”
To avoid this error bring the Database into Single_user Mode and drop it.
Here option ‘WITH ROLLBACK IMMEDIATE’ in the first ALTER DATABASE statement will be rolled back all incomplete transactions and disconnect any other connections to the [CourtesyIndiaDB] database immediately. Then Drop the DATABASE.