Closed codepb closed 6 years ago
I've looked into this, and it should be as simple as adding "IF db_id('$databaseName') IS NOT NULL" to the start of the backup command. I don't know if you would prefer to include this by default or have it as a configurable parameter in VSTS. I can create a pull request to implement this if you'd like?
I think I'd rather add a tick box and make the check optional.
You could also do it via you own script and run that using the Single Script task.
I'll see if I can figure out how that works and submit a pull request. Thanks.
This should go out in the next release next week
Hi,
I'm using the SQL Backup tasks, and was wondering if there was a way to only run it if the database exists? Looking at the script, it appears the check could be added by running a SQL query to see if a database by the name exists first before running the backup command.