How to dynamically get data from different source

  • Hi,

    How to Get data from Different Sources Dynamically (ie.., One week from Excel and another week from Text File)

    Thanks in advance

  • Krishna,

    Could you be more specific with your requirements?

    Raunak J

  • You need a seperate data flow for each type of source. Even if you have 2 excel files but with different structure, you need 2 different dataflows. Then choose conditionally which dataflow to run.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • I created 2 variable . one for File location and one for flag to determine for file extension.

    I wrote the following code in script task

    if (DTs.Variables['Filelocation"].value.ToString()).Contains (".txt"))

    DTs.Variables["isTxt"].value=True;

    else

    DTs.Variables["isTxt"].value=True;

    i created 2 Data flow tasks (txt and Xls)

    in the Precedence Constraints, i added expression @isTxt==True

    Its works fine.

    I just need to know is there any other best solution.

    Thanks in advance

  • The solution you worked out seems fine to me.

    You only need to make sure that no other .txt or .xls file comes in with a different metadata structure, as it would cause the package to fail.

    You can also make it more robust:

    - what happens if a .csv file comes in?

    - you can add event handlers that clean up the files if there is an error

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

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

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