SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Backup by datetime file name

By Jason S Wong,

It is an optional tool to use SQL Server Maintainence Plan to schedule regular backups of your databases. To take advantages of full control, total flexibility, I use my own scripts to backup databases. Here is an simple example to show how to backup database by the datetime file name. You can simply modify this to run differential backup or to backup log. Put them as SP in AdminDB and schedule Agent Job for it, just that simple. Use my other script to check review disk space. If you have custom request, please email me.


I suggest readers further enhance this script by coding the parameter in database table such as the backup drive letter, use sys.sysservers to get server name, use a loop to pick up active db names (see my other code publication), use xp_cmdshell to create backup directory, use admindb data table to store runtime and status, etc. I have coded comprehansive DB backup scripts I use for the DBs I manage.

Total article views: 1876 | Views in the last 30 days: 2
Related Articles

Powershell Database Backup Script

Learn how to write a script for regular database backups using Powershell and SMO.


xmla script for automate ssas database backup

xmla script for automate ssas database backup


Script to Check the Database Backup duration

Script to Check the Database Backup duration of entire instances


Backup & Restoration Script

This script provides very useful information about database backup and restoration.


Database Backup Information Scripts

Scripts used to validate the backups information as below 1) Database Backups for all databases F...