Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

drop database & deleting files

Status
Not open for further replies.

minerat

Technical User
Jul 11, 2005
4
US
I'm having a problem with my SQL 2000 server and getting rid of old databases. When I DROP DATABASE or sp_dbremove, the database is removed from enterprise manager, but the mdf & ldf still remain. MSDN documentation for both commands states that it will remove disk files associated with the database, but that's not happening. If I delete the database through the Enterprise Manager the files are deleted. I've got 80 dbs to get rid of and I'd like to do it programatically. Any ideas?

 
I don't drop databases often enough to tell you for sure, but it has been hit and miss when I do, and I often have to delete the files manually after dropping.

SQL/SAP DBA
 
Here is an alternate option
declare @data varchar(255)
select @data='del C:\Msql\Data\*.mdf'
exec master..xp_cmdshell @data
select @data='del C:\Msql\log\*.ldf'
exec master..xp_cmdshell @data
select @data='del C:\Msql\Backup\*.bak
exec master..xp_cmdshell @data



Dr. Sql
goEdeveloper@yahoo.com
Good Luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top