Kill database

VeRiTo
04-15-2004, 11:03 AM
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.

HardCode
04-15-2004, 11:46 AM
From Books On-Line of SQL Server 7:


DROP DATABASE (T-SQL)
Removes one or more databases from Microsoft® SQL Server™. Removing a database deletes the database and the disk files used by the database.

Syntax
DROP DATABASE database_name [,...n]

Arguments
database_name
Specifies the name of the database to be removed. Execute sp_helpdb from the master database to see a list of databases.
Remarks
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 .

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

Examples
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
CREATE DATABASE USE
sp_helpdb sp_dropdevice






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

VeRiTo
04-15-2004, 11:48 AM
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