hexvader
asked on
How to change a filename during a swl on the fly.
Some Background:
My company has production servers and on a daily basis we download a database to our lan so we can run reports from it. The code we use to load the database is as follows:
USE master
RESTORE DATABASE cheshire_Reporting
FROM DISK = 'C:\BAckup\cheshire\cheshi re_backup_ 2007111900 30.bak'
WITH REPLACE
, MOVE 'cheshire_Data' TO 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\ cheshire_r eporting_D ata.mdf'
, MOVE 'cheshire_Log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\ cheshire_r eporting_L og.ldf'
, MOVE 'sysft_ft_cheshire' TO 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\ sysft_ft_c heshire_re porting'
GO
I created a sql jog with this code and it works with no problems.
Problem:
My production server is set up to save the .bak file as the filename_Backup_Date.bak.
For ex. - cheshire_backup_2007111900 30.bak
This date changes everyday
Question - Is there a way to create a sql server job that I can set up to run daily that will take this name
change into consideration??
thanks
John
My company has production servers and on a daily basis we download a database to our lan so we can run reports from it. The code we use to load the database is as follows:
USE master
RESTORE DATABASE cheshire_Reporting
FROM DISK = 'C:\BAckup\cheshire\cheshi
WITH REPLACE
, MOVE 'cheshire_Data' TO 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\
, MOVE 'cheshire_Log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\
, MOVE 'sysft_ft_cheshire' TO 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\
GO
I created a sql jog with this code and it works with no problems.
Problem:
My production server is set up to save the .bak file as the filename_Backup_Date.bak.
For ex. - cheshire_backup_2007111900
This date changes everyday
Question - Is there a way to create a sql server job that I can set up to run daily that will take this name
change into consideration??
thanks
John
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks and happy Thanks!