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:

    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.

Related posts

RSS feed for comments on this post · TrackBack URL

Leave a Comment

Creative Commons Attribution-ShareAlike 2.0 UK: England & Wales
Creative Commons Attribution-ShareAlike 2.0 UK: England & Wales