The following script will delete a database even if it is in use:
EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'MyDatabase'
GO
USE [master]
GO
ALTER DATABASE [MyDatabase] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
ALTER DATABASE [MyDatabase] SET SINGLE_USER
GO
USE [master]
GO
DROP DATABASE [MyDatabase]
GO
Hope it helps.
http://www.IKOSoftware.com
Thursday, October 4, 2007
Subscribe to:
Post Comments (Atom)
1 comment:
Post a Comment