Conditional Execution of SSIS Package

  • Hi,

    Scenario:

    Client may provide either XLS file or CSV file with data for upload

    My assumption:

    Decalre a variable and set value in that variable using script to identify file format.

    Based on that value execute respective SSIS package.

    Is there any better way?

    Is it possible to use single SSIS instead?

  • I'd read the file name into a variable and use the variable in a precedent constraint to send it to one of 2 data flow tasks, 1 that handles the xls file and the other that handles the csv file.

  • Well! following are my requiremetns:

    1. If file file format is xls then

    1.1 convert XLS file into CSV format

    1.2 Execute respective package for uploading data from CSV file

    3 Else if file is in CSV format then 1.2

    Hope this would be helpful!

    Thanks

  • SMAZ (11/25/2008)


    Well! following are my requiremetns:

    1. If file file format is xls then

    1.1 convert XLS file into CSV format

    1.2 Execute respective package for uploading data from CSV file

    3 Else if file is in CSV format then 1.2

    Hope this would be helpful!

    Thanks

    1.1 Excel sources can be troublesome - I'd use a script component for 1.1 to create the CSV file if source = XLS, otherwise terminate with success.

    1.2 Followed by a standard dataflow to bring in the CSV.

    Phil

    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

  • I would do things a little differently then others have suggested. I would write two separate foreach loops, one to search for all xls files in the source directory and perform your import and one to search for all txt / csv files. Converting the xls to csv from script is probably a better performing solution, and easier to implement if you do not already have the xls import piece built. But, I like to import directly from source to staging and then import from the staging to the destination by calling a stored procedure. This is not necessarily great for performance as it does not leverage some of the SSIS functionality, but I prefer working in T-SQL.

Viewing 5 posts - 1 through 4 (of 4 total)

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