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:

    select name from sysdatabases where name !='tempdb'

     

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

    select name from sysdatabases where name ='MyDatabase'

     

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.

Written by Phil Wiffen

Phil is an IT Professional working in Cambridge, England. He generally blogs about useful solutions that he comes across in his work/play.

Leave a Reply

Your email address will not be published. Required fields are marked *