Kill database

04-15-2004, 12:03 PM
Hi people! I want to drop a database (MS SQL SERVER 2000) and i cant cause this is in use. The problem is that DB is 'suspect'. Any way to set it offline and then drop it?
Thanks in advance.

04-15-2004, 12:46 PM
From Books On-Line of SQL Server 7:

Removes one or more databases from Microsoft® SQL Server™. Removing a database deletes the database and the disk files used by the database.

DROP DATABASE database_name [,...n]

Specifies the name of the database to be removed. Execute sp_helpdb from the master database to see a list of databases.
The database context of the connection must be in the master database to use DROP DATABASE.

In SQL Server version 7.0, DROP DATABASE removes damaged databases that have been marked suspect. DROP DATABASE removes the specified database unless it has been marked OFFLINE.

A database that has been dropped can be re-created only by restoring a backup. You cannot drop a database currently in use (open for reading or writing by any user). Whenever a database is dropped, the master database should be backed up .

DROP DATABASE permission defaults to the database owner and members of the sysadmin fixed server role, and is not transferable.

A. Drop a single database
This example removes all references for the publishing database from the system tables.

DROP DATABASE publishing

B. Drop multiple databases
This example removes all references for each of the listed databases from the system tables.

DROP DATABASE pubs, newpubs

See Also
ALTER DATABASE sp_renamedb
sp_helpdb sp_dropdevice

(c) 1988-98 Microsoft Corporation. All Rights Reserved.

04-15-2004, 12:48 PM
Thanks for help! i have already read that.
I had a problem with the restoring model.
thanks anyway!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum