While working on making an automated Delete and Restore script for my backups I ran into a snag. I can not delete the database; however, the delete button works exactly how I need it to. Can anyone tell me the script for that delete button?
I have also tried another query to do this task, however it is not working like I would like. Here is the code:
> USE CENTRAL ALTER DATABASE DATABASE REMOVE FILE DATABASE_1.LDF ALTER DATABASE DATABASE REMOVE FILE DATABASE_2.LDF ALTER DATABASE DATABASE REMOVE FILE DATABASE.MDF ALTER DATABASE DATABASE SET SINGLE_USER WITH ROLLBACK IMMEDIATE ALTER DATABASE DATABASE SET OFFLINE EXEC sp_detach_db DATABASE, true; DROP DATABASE DATABASE GO
The error that I get when I run the code is:
Executed as user: NT AUTHORITY\SYSTEM. Incorrect syntax near '.'. [SQLSTATE 42000] (Error 102) Incorrect syntax near '.'. [SQLSTATE 42000] (Error 102) Incorrect syntax near '.'. [SQLSTATE 42000] (Error 102). The step failed.
I am not sure what I am doing wrong, can someone please tell me?