use [master]
drop database [databasename]
I got following error
Database could not be dropped because the database is in use
then i ran following script to deop database and it worked.
use [master]
go
Alter Database [databasename]
SET SINGLE_USER With ROLLBACK IMMEDIATE
go
go
drop database [databasename]
go
then i ran following script and got the error part of which is below the part of script
use[master]
IF
EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'databasename')
DROP
DATABASE [databasename]
GO
i had 5 such drops i took some out here .....for the posting purpose
RESTORE
DATABASE [databasename] FROM
DISK
= N'C:\dbbak\mybatabase.bak' WITH
FILE
= 1,
MOVE
N'my.C.Data' TO N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\databasename.MDF',
MOVE
N'my.C.Log' TO N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\databasename.ldf',
NOUNLOAD
, REPLACE, STATS = 10
i had some more restores in same manner.
the error i am getting now is
Database 'databasename' does not exist. Make sure that the name is entered correctly.
Msg 911, Level 16, State 1, Line 1
Database 'databasename' does not exist. Make sure that the name is entered correctly.
Msg 911, Level 16, State 1, Line 1