I am trying to change the recovery model of the current database.
This is what I have:
DECLARE @dbName VARCHAR(50)
SELECT @dbName = DB_NAME()
ALTER DATABASE @dbName SET RECOVERY SIMPLE WITH NO_WAIT
@dbName
gives me:
Incorrect syntax near '@dbName'.
I tried:
ALTER DATABASE database_id SET RECOVERY SIMPLE WITH NO_WAIT
database_id
gives me:
Msg 5011, Level 14, State 5, Line 3 User does not have permission to alter database 'database_id', the database does not exist, or the database is not in a state that allows access checks.
How should I execute this on the current database?