Home > SQL Challenge > Drop Database

Drop Database

–A database can be dropped regardless of its state: offline, read-only, suspect, and so on.
–To display the current state of a database, use sys.databases catalog view
select * from sys.databases
where name in (‘EAMPC’)

–Database currently being used cannot be dropped.
–This means open for reading or writing by any user.
–To remove users from the database, use ALTER DATABASE to set the database to

–Dropping a database deletes the database from an instance of SQL Server and
–deletes the physical disk files used by the database.
–If the database or any one of its files is offline when it is dropped,
–the disk files are not deleted. These files can be deleted manually by using
–Windows Explorer. To remove a database from the current server without
–deleting the files from the file system, use sp_detach_db.
drop database EAMPC;

Categories: SQL Challenge
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: