![]() ![]() After executing it, you will get a bak file with a name consisting of database plus backup date. SELECT = (SELECT 'filepath\databasename' convert(varchar(500), GetDate(),112) '.bak')īACKUP DATABASE databasename TO įill in your own backup path and database name, and copy the script to a new query window. To back up one specific SQL database with date, you can use SQL backup command with date in filename, such as: SQL backup command with date in filename (one database) Easier way to schedule SQL backup and restore to any precise date.How to schedule SQL backup with date in filename?.Script to backup all SQL databases and add dates to filenames.SQL backup command with date in filename (one database). ![]() Keep reading and pick the way you prefer: Or you can turn to a specialized SQL backup tool to schedule SQL database backup and revert to a previous date intuitively. To do this, the most common method is using effective T-SQL scripts. But if there are a large number of databases, or you want to perform backup tasks regularly and keep different versions of bak files ( create daily database backups with unique names in SQL Server, for example), you may need a more automated and intelligent way to add date to filename of SQL backup. Normally you can specify the filenames yourself when using SSMS GUI or T-SQL to backup database. But now I have been asked to put a date and time stamp at the end of the. I am creating a SQL query script to backup a database, which I have done fine. ![]()
0 Comments
Leave a Reply. |