In MS SQL Server, you can't run the
DROP DATABASE statement with a variable name like the following:
-- This statement will not work. DROP DATABASE @dbname;
It will display the following error message.
Msg 102, Level 15, State 1, Line 3
Incorrect syntax near '@dbname'.
Instead, use the following statement.
EXEC('DROP DATABASE ' + @dbname);