I'm having trouble getting a command to run in a stored procedure to bring some databases online that had previously been restored with no recovery. In the stored procedure the code is:
CREATE Procedure sp_RecoverAllDatabases
BEGIN...
RESTORE DATABASE productinfo WITH RECOVERY
...
I get an error the following error:
Server: Msg 927, Level 14, State 2, Procedure sp_RecoverAllDatabases, Line 15
Database 'productinfo' cannot be opened. It is in the middle of a restore.
However, if I run the line "RESTORE DATABASE productinfo WITH RECOVERY" in query analyzer, it restores the database and brings it back on line. Any idea what the core issue is here?
Thanks in advance for any help.
CREATE Procedure sp_RecoverAllDatabases
BEGIN...
RESTORE DATABASE productinfo WITH RECOVERY
...
I get an error the following error:
Server: Msg 927, Level 14, State 2, Procedure sp_RecoverAllDatabases, Line 15
Database 'productinfo' cannot be opened. It is in the middle of a restore.
However, if I run the line "RESTORE DATABASE productinfo WITH RECOVERY" in query analyzer, it restores the database and brings it back on line. Any idea what the core issue is here?
Thanks in advance for any help.