• Scott,

    This is an awesome script. I use it on my SQL Server to backup our production DB full weekly, incremental nightly, and transaction log every 5 minutes.

    However, do you have an analog to RESTORE the database? We have a reporting instance that we used to refresh nightly from production, but now that I don't do a full DB backup every night my existing SQL Server job can't run, so I'm forced to (for now) restore the incremental by hand every day.

    I'm comfortable scripting another proc to be in sync (e.g. every Monday morning restore the full DB, every other day restore the incremental) but the part that I'm having trouble with is determining which incremental to pick up (since it's some sort of random number appended to the file name)...

    In theory, I'd want to get the most recent full or incremental backup when running the restore, e.g.:

    restore 'MYDB', 'FULL', 'P:\ath\to\backups', 'somedate' = null

    if the date was entered, look for the most recent full on that date otherwise pick the most recent full in the dir...

    Thoughts?