Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stored Procedure Context

Status
Not open for further replies.

dcf1023

Programmer
Jun 5, 2003
5
US
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top