ncammann
asked on
MSSQL Restore
I have a developement SQL server that I would like to restore copies from two Live database on a weekly basis. I need to be able to trust a less technical person to do this on occasion so wanted to script it. However the backup file passed from the production server has a name -
"database_backup_2012_02_0 7_4905093" etc.
in other words they are (usefully) data and time stamped & serial numbered.
Is there a way within the T-SQL script to allow for this?
-------------------------- ---------- ------
RESTORE DATABASE [Membership] FILE = N'Membership' FROM DISK = N'E:\Membership_backup_201 2_02_07_01 0001_49050 93.bak' WITH FILE = 1, MOVE N'Membership' TO N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSER VER\MSSQL\ DATA\Membe rship.mdf' , MOVE N'Membership_log' TO N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSER VER\MSSQL\ DATA\Membe rship.ldf' , NOUNLOAD, STATS = 10
GO
-------------------------- ---------- ---------- ---------- -----
Thanks
Nigel
"database_backup_2012_02_0
in other words they are (usefully) data and time stamped & serial numbered.
Is there a way within the T-SQL script to allow for this?
--------------------------
RESTORE DATABASE [Membership] FILE = N'Membership' FROM DISK = N'E:\Membership_backup_201
GO
--------------------------
Thanks
Nigel
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.