• As it's currently written your sql will only work if you have a single database listed in your backups table.

    I think I would use a cursor to loop down your table a row at a time.

    For each row then build up the sql statement (similar to your sql)

    and then exec it

    You need to think about how errors will be handled. What happens if the first database in the list can't be backed up. Does the script continue, how will you be alerted?

    What's the error message you are currently seeing?