for loop (SSIS 2008 r2)

  • Hi ,

    I have a scenario like ........I have 6 flat files(Country1,Country2,Country3,.......Country6) in the source and i need to fetch the records of Country1 flat file to Country1 table in destination.Similarly Country2 flat file to Country2 and so on.

    Can anyone help with this.I tried using forloop but i am getting the records of country1 to all the tables>i dont know where i am wrong

    Thanks in advance

    Karthik

  • challakarthik (10/5/2014)


    Hi ,

    I have a scenario like ........I have 6 flat files(Country1,Country2,Country3,.......Country6) in the source and i need to fetch the records of Country1 flat file to Country1 table in destination.Similarly Country2 flat file to Country2 and so on.

    Can anyone help with this.I tried using forloop but i am getting the records of country1 to all the tables>i dont know where i am wrong

    Thanks in advance

    Karthik

    Hi and welcome to the forum. First of all, please do not post a question on multiple threads as it tends to dilute the answers.

    What you need in your package is a ForEach loop with the enumeration property set to "Foreach File Enumerator", a variable to store the file names and an expression in the flat file connection manager. Suggest you start by reading through the Stairway to Integration Services[/url] articles for more details.

    😎

  • challakarthik (10/5/2014)


    Hi ,

    I have a scenario like ........I have 6 flat files(Country1,Country2,Country3,.......Country6) in the source and i need to fetch the records of Country1 flat file to Country1 table in destination.Similarly Country2 flat file to Country2 and so on.

    Can anyone help with this.I tried using forloop but i am getting the records of country1 to all the tables>i dont know where i am wrong

    Thanks in advance

    Karthik

    Are the formats of the files the same?

    If so, why are you using multiple destination tables, rather than a single table with a 'SourceFile' column?

    If the file formats are all different, I'm not sure how a loop is going to help you. Just create six dataflows and run them in parallel.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Hi Eirikur Eiriksson,

    Sorry Actually this is my first post.So i dont know how to post

    Thnaks & regards

    Karthik

  • Hi Phil Parkin,

    Actually in my scenario country1 contains records of AUstralia,Country2 contains records of Canada,Country3 contains records of France..........Country6 contains records of United States

    I dont want to rename flat files , tables and want to use only for loop

    I have 6 flat files country1.txt , country2.txt , country3.txt,............country6 in the source.And

    I have 6 tables country1,country2,country3.....country6

    I took two variables

    1:@count

    2:@Dynamiccounryname

    Written an expression for @dynamiccounryname like( "country"+ (DT_WSTR,10 ) @[User::count])

    and for OLEDB destination I used Table or vies variable with(@Dynamiccounryname)

    The problem is i am getting records of country1 to all tables.Please help me with this

    Thanks & Regards

    Karthik

  • As you did not answer all of my questions, it is difficult to help you.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Hi Phil Parkin,

    Thank you for your response

    I got it the thing is i wrote expressions for flat file connection(properties)

    Thanks & Regards,

    C Karthik

Viewing 7 posts - 1 through 6 (of 6 total)

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