Flat File Name Changing but one Destination Table

Beantwortet Flat File Name Changing but one Destination Table

  • Thursday, January 17, 2013 10:12 PM
     
     

    Hi

    Please help me

    I have a folder which will Have Flat file . The name of Flat file will keep changing. 

    Say   A_1_C for the first time and Next Day or week it will change to A_22_C

    I need to Load the data in Table .

    How to do this Package Dynamically.

    Regards

    Kodi

All Replies

  • Friday, January 18, 2013 1:42 AM
    Moderator
     
     Answered

    Hi Kodi,

    Just implement a ForEach Loop with a File enumerator with its mask for the files property name set to *.*

    A more detailed example is in http://www.sqlis.com/sqlis/post/Looping-over-files-with-the-Foreach-Loop.aspx


    Arthur My Blog

    • Marked As Answer by KODI_KODI Sunday, January 20, 2013 12:45 AM
    •  
  • Friday, January 18, 2013 1:51 AM
     
     Answered

    Hi,

    You can follow this example. and need to

    1. Change the File in the For Each Loop Container Editor, under Collection menu to A_*.txt.

    2. Add a Execute SQL Task to insert the file name into a table inside the For Each Loop Container above of the Data Flow Task and add another Execute SQL Task to check weather the filename is already exist in the database outside and above of For Each Loop Container.

    now, if you want to extend it a notch further, you may want to add some File System Task to transfer or copy the process file to other folder inside the For Each Loop Container.

    HTH,

    

    • Proposed As Answer by Shihab Jamil Friday, January 18, 2013 4:08 AM
    • Marked As Answer by KODI_KODI Sunday, January 20, 2013 12:44 AM
    •