Tuesday, June 16, 2009

Renaming SQL Backup Files

If you use a SQL 2005 Maintenance Plan to create backups of individual databases, the .bak files have a date stamp on them. I have a customer that wants to handle the files with an automated tool and would prefer that the backup files have a consistent name. We could backup up the databases en masse, but we wanted separate backups for this purpose.


The solution was to create a VB script that runs as a scheduled task and renames the files every night after the backups are run. Here is the code that I wrote to handle renaming all of the files.

-------------------------------


------------------------------------------

Note: this will fail in 2100. Just setting up some Y2100 work for your grandchildren.

1 comment:

  1. Friend said me about one nice tool-recover mdf,which recover sql files.And after some time I used it and tool recovered all my data very quickly.Besides that it executed this operation for free and showed repair .mdf files of Microsoft SQL Server 2005.

    ReplyDelete