Backing up SQL Express Databases

A scheduled script such as this which has hard coded the name of the sql command file, set it to run in the folder containing the backups

echo %0 starting 
date /t 
time /t 
dir 
sqlcmd -S localhost\caserver -i "%programfiles%\custom\sql_express_database_name_backup.sql"

Which calls a SQL commands file containing this which contains the hard coded name of the database and location of backup files.

BACKUP DATABASE [My_Database] TO  DISK = N'E:\Backup\My_Database' WITH NOFORMAT, INIT,  NAME = N'My_Database-Full Database Backup', SKIP, NOREWIND, NOUNLOAD,  STATS = 10
GO

Microsoft have a much more powerful script referenced here

Technet How to schedule and automate backups of SQL Server databases in SQL Server Express

About Jeff Turner

Technical director of Nano Tera Network Solutions.
This entry was posted in Hints and Tips, System Administration. Bookmark the permalink.