Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 How to restore using S.P
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sunny_10
Yak Posting Veteran

72 Posts

Posted - 03/14/2013 :  01:38:04  Show Profile  Reply with Quote
Hi

How i can restore database using Stored Procedure

Thanks

ScottPletcher
Aged Yak Warrior

USA
550 Posts

Posted - 03/14/2013 :  12:48:41  Show Profile  Reply with Quote
You can use a RESTORE DATABASE command inside the stored proc:


CREATE PROCEDURE ...
...
SET @db_name_to_restore = ...
SET @backup_file_to_restore = 'x:\full\path\to\backup\file\backup.bak'
RESTORE DATABASE @db_name_to_restore
FROM DISK = @backup_file_to_restore

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000