Backing up specific databases with Brian Knight’s SQL Express backup script

Just a follow up to my previous post, covering the Automation of SQL Express Backups

As Brian’s scripts are aimed at non-techies, he wisely coded them to backup all SQL databases on the host. If you’d prefer to back up just one specific SQL database, all you need to do is:

  1. Open up BackupExpress.sql in an editor.
  2. Find the line:

  3. Remove the exclamation mark, and replace tempdb with the name of your database, like so:


Nice and easy 🙂

If you’re wondering what the exclamation mark does, it means “exclude”. So Brian’s original script backed up every database except tempdb. By removing the exclamation mark, we’re explicitly choosing a database to backup, and excluding all others.

Automated Backups for MS SQL Express

If you’ve ever struggled with configuring automated, scheduled backups for a SQL Express server, then check out Brian Knight’s super handy scripts.

The script contains three files:

  • BackupExpress.sql – Does the bulk of the work, backing up every database on the instance other than tempdb.
  • BackupExpress.cmd – The batch file that executes the script. Must pass in the instance name.
  • ScheduleBackups.cmd – Schedules the job by using AT. Must pass in the instance name to schedule like ScheduleBackups.cmd .\SQLExpress.

To do this, make sure you have the Task Scheduler service started. Uncompress all three of the files into the root of your C drive and run the schedule file from the command prompt.

I tried to keep the solution simple since most people that have SQL Express on their workstation may not be technical. So with that said, there is very little configuration or options. The backup solution keeps 7 days of history and constantly overwrites the previous week’s backup.

Grab the scripts from the full blog post.

Don’t forget to add the Instance name of your SQL Express Server when you run ScheduleBackups.cmd from the command line, like so: