MSSQL%20Interview%20Questions%20and%20Answers
Question: Why I am getting this error when dropping a database in MS SQL Server?Answer: If you are trying to drop a database that is in use, you will get an error message like this: 'Cannot drop database "withoutbook" because it is currently in use.'Before dropping a database, you must stop all client sessions using this database. If your own client session is using this database, you should set a different database as the current database as shown in this tutorial example: CREATE DATABASE withoutbook GO USE withoutbook GO DROP DATABASE withoutbook GO Msg 3702, Level 16, State 4, Server LOCALHOSTSQLEXPRESS Cannot drop database "withoutbook" because it is currently in use. USE master GO DROP DATABASE withoutbook GO |
Is it helpful?
Yes
No
Most helpful rated by users:
- What is Microsoft SQL Server?
- What is the simplest way to create a new database in MS SQL Server?
- How to delete a database in MS SQL Server?
- How to download and install Microsoft .NET Framework Version 2.0?
- How To Get a List of Columns using the "sp_help" Stored Procedure in MS SQL Server?