How to Pass a List of DatabaseNames to the "Backup Database" Task

  • Hi,

    I try to Backup Specific Databases with the DatabaseBackup Task.

    I thought i pass a List of Database Names to the Expression SelectedDatabases.

    But it does not work.

  • Can you expand on "it does not work" - post error messages please.

    Also, you may think it's obvious, but it makes things easier for people reading if you explicitly state your question, rather than leaving us to work it out.

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • Oh Ok sorry ...

    I create a ResultSet of Database Names with "Execute SQL Task" and save the Result Set into an Object Variable.

    Then i thought i can pass the Variable trough the "SelectedDatabase" Expression in "BackupDatabase Task".

    I think the DataType of the Variable is Wrong but i didnt Find the right One 🙁

    Sorry for my bad English...

    The Error Message is: ehm .. its in German 🙁

    SSIS-Paket 'Package.dtsx' gestartet.

    Fehler: 0xC00470D0 bei Backup incremental: Der Datentyp der User::DBResult_Full-Variablen wird in einem Ausdruck nicht unterstützt.

    Fehler: 0xC00470EA bei Backup incremental: Fehler beim Lesen der User::DBResult_Full-Variablen (Fehlercode: 0xC00470D0).

    Fehler: 0xC0017003 bei Backup incremental: Der Ausdruck '@[User::DBResult_Full]' in der SelectedDatabases-Eigenschaft wurde nicht ausgewertet. Ändern Sie den Ausdruck so, dass er gültig ist.

    Warnung: 0x80019002 bei Backup incremental: SSIS-Warnungscode 'DTS_W_MAXIMUMERRORCOUNTREACHED'. Die Execution-Methode wurde erfolgreich ausgeführt, aber die Anzahl von ausgelösten Fehlern (8) hat den maximal zulässigen Wert erreicht (1). Deshalb tritt ein Fehler auf. Dieses Problem tritt auf, wenn die Anzahl von Fehlern den in 'MaximumErrorCount' angegebenen Wert erreicht. Ändern Sie den Wert für 'MaximumErrorCount', oder beheben Sie die Fehler.

    Fehler beim Task: Backup incremental

    SSIS-Paket 'Package.dtsx' fertig gestellt: Erfolg

  • Got to love those German error messages 🙂

    OK, I think you are on the right track though - you just need to know what format to pass in the list of db names and then adopt it. I'm sorry, but I do not know the answer for sure.

    It looks to me like the Selected Databases property is a collection of database objects. But how do you populate that in code? I would have to experiment.

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • Thx .. i have found an Post where somone change the Expression from an other Package with a Script Task ...

    but .. i would do this now in TSQL 🙂

  • Good luck!

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • If I understood correctly what you're doing, I think you'll have to pass the resultset to a ForEach Container which contains you backup task. Inside the forEach container, you can pass, one at a time, each database name contained in the resultset to the backup task.



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • Alvin Ramard (8/31/2010)


    If I understood correctly what you're doing, I think you'll have to pass the resultset to a ForEach Container which contains you backup task. Inside the forEach container, you can pass, one at a time, each database name contained in the resultset to the backup task.

    I would have thought that there would be a way of setting the 'Selected Databases' property of the backup task and then letting the task itself do the iteration around the multiple databases. But you never quite know for sure with SSIS until you try ...

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • Phil Parkin (8/31/2010)


    Alvin Ramard (8/31/2010)


    If I understood correctly what you're doing, I think you'll have to pass the resultset to a ForEach Container which contains you backup task. Inside the forEach container, you can pass, one at a time, each database name contained in the resultset to the backup task.

    I would have thought that there would be a way of setting the 'Selected Databases' property of the backup task and then letting the task itself do the iteration around the multiple databases. But you never quite know for sure with SSIS until you try ...

    Phil, I answered the question without looking at the Task. I suspect there is a way of doing this using a Script Tasks if the SQLStatementSourceType is set to Variable. The Script Task could set the value of this variable. I have no idea what the variable should contain.



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • This was removed by the editor as SPAM

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply