Why I am getting this error when dropping a database in MS SQL Server?
Submitted by: AdministratorIf you are trying to drop a database that is in use, you will get an error message like this: 'Cannot drop database "GlobalGuidelineData" 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 GlobalGuidelineData
GO
USE GlobalGuidelineData
GO
DROP DATABASE GlobalGuideLineDatabase
GO
Msg 3702, Level 16, State 4, Server LOCALHOSTSQLEXPRESS
Cannot drop database "GlobalGuideLineDatabase" because it is
currently in use.
USE master
GO
DROP DATABASE GlobalGuideLineDatabase
GO
Submitted by: Administrator
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 GlobalGuidelineData
GO
USE GlobalGuidelineData
GO
DROP DATABASE GlobalGuideLineDatabase
GO
Msg 3702, Level 16, State 4, Server LOCALHOSTSQLEXPRESS
Cannot drop database "GlobalGuideLineDatabase" because it is
currently in use.
USE master
GO
DROP DATABASE GlobalGuideLineDatabase
GO
Submitted by: Administrator
Read Online MS SQL Server Job Interview Questions And Answers
Top MS SQL Server Questions
☺ | What Happens If NULL Values Are Involved in Bitwise Operations? |
☺ | What Happens If Strings Are Casted into Wrong Code Pages in MS SQL Server? |
☺ | How To Use Subqueries with the IN Operators in MS SQL Server? |
☺ | PHP MSSQL - How To Display a Past Time in Days, Hours and Minutes? |
☺ | How To Configure ODBC DSN with Different Port Numbers? |
Top Databases Programming Categories
☺ | RDBMS Interview Questions. |
☺ | SQL Interview Questions. |
☺ | SSRS Interview Questions. |
☺ | Sybase Interview Questions. |
☺ | Database Administrator (DBA) Interview Questions. |