--HOW TO ATTACH OR RESTORE DB FROM MDF AND LDF FILES AFTER DB DELETED
--If old DB is already deleted,Create a New DB
--Take the database in offline mode
--Then run the following System
SP_DETACH_DB <DatabaseName>
eg:-
EXEC SP_DETACH_DB 'TEMPDATABASE'
--This make the Database in Detach Mode
--Now to bring the database in attached mode
--Your attach statments needs to specify both files in one command, MDF first.then LDF second Thus, change it to:
Exec SP_ATTACH_DB
@DBNAME = <DatabaseName>,
@FILENAME1 = <Loction.mdf>,
@FILENAME2 = <Location_Log.ldf>
eg:-
Exec SP_ATTACH_DB
@DBNAME = N'TEMPDATABASE',
@FILENAME1 = N'NEW.MDF',
@FILENAME2 = N'NEW_LOG.LDF'