SQL Server Forums
Profile | Register | 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
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sunny_10
Yak Posting Veteran

65 Posts

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

How i can restore database using Stored Procedure

Thanks

ScottPletcher
Constraint Violating Yak Guru

USA
346 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  
 New 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.03 seconds. Powered By: Snitz Forums 2000