Sproc for Restore

Sproc for Restore

 

  

Gurus,



I'd like to create a sproc to restore a db on a different machine in my
network. How can I tell SQL Server to use the master db on the other
machine to execute it?



create proc dbo.usp_c_RestoreMyDB

as



RESTORE DATABASE MyDB

FROM DISK = 'D:\MSSQL\BACKUP\MyDB.bak'

WITH RECOVERY,REPLACE,

MOVE MyDB TO 'D:\mssql\data\MyDB.mdf',

MOVE 'MyDB_log' TO 'D:\mssql\log\MyDB_log.ldf'



Go



Thanks for any help!



Gerald Hopkins

Database Administrator

School-Link Technologies, Inc.

(800) 423-2113 x8954



CONFIDENTIALITY NOTICE: This message (including any attachments)
contains confidential information intended for a specific individual and
purpose, and is protected by law. If you are not the intended recipient,
you should delete this message and are hereby notified that any
disclosure, copying, or distribution of this message, or the taking of
any action based on it, is strictly prohibited




MS Sql Server LazyDBA home page