Monday, 31 July 2017

Get dynamic file name using foreach loop container SSIS

When we are working with file in SSIS we need to set the file name dynamically. We can’t hard coded the file name. If in a folder we have multiple file and want to load all file to database in this case we need to get the file name. In this article we will learn how we get the dynamic file name.
Let’s see the example.

TestData folder I have some file. I want to get the file name dynamically.
Open SSDT.
For enumerator we need to take foreach loop container.
  
Double click on the foreach loop container.
Foreach loop editor will be open.
Go to collection tab.

Select foreach file enumerator.
Now we need to select the folder where stored

Write the file extension and select the retrieve file name. If you want to fetch the all file which is in sub folders the select Travers sub folder option.
Now we need to create a variable which store the file name.

Creating a variable name as filename which store the file name.
Now I am taking script task inside foreach loop container to display the file name.

Double click on the script task.
 

Select the variable name.
Click on the edit script button and write the C# script to display the file name.

Save and close it. Now package is ready to run. Now I am running the package.


Got the expected output.

4 comments:

  1. Its really good blog and very information, we are tempo traveller rental company in faridabad providing tempo traveller in faridabad for local and outstation, we have luxury tempo traveller in faridabad you can rent 12 seater, 17 seater , 20 seater , 26 seater Tempo traveller faridabad to outstation tours ~ JBL Tempo Traveller Rentals Delhi NCR ~ 9560075009
    Our location : FCA-1405, Block - C, SGM Nagar, Sector 48, Faridabad, Haryana 121001


    tempo traveller in noida
    tempo traveller in Ghaziabad
    tempo traveller in gurgaon
    tempo traveller in faridabad
    tempo traveller in delhi

    ReplyDelete
  2. Good Post! Thank you so much for sharing this pretty post,
    Power BI Online Training from OnlineITGuru will help you to get all the required knowledge and guidance to become an expert in Power BI Course. Join india's best Power BI Online Training India institute now and get your desired job. For more info about Power BI Online Training India.
    power bi training | power bi online course

    ReplyDelete
  3. Hello everyone on here my name is Fumo Sadiku living in Malindi City Kenyan I want to tell a little more about a good hearted man called Mr Pedro working with funding service as loan officer, Mr Pedro helped me get a loan of 37,115,225.00 Shillings on my trying time trying to get back on my feet to raise my business I know there are some of you here who are in financial difficulties to talk to Mr Pedro pedroloanss@gmail.com I'm so glad for what he did for me and for his Bank accountant as well Accountant Hernandez Lucas Thank you very much for your work well done.

    ReplyDelete
  4. Are you looking for a positive loan lender to set your financial problem free then you would like pedro loan offer, Pedro offer me a loan at the rate of 3% ROI and all process went smoothly as I expected you can email him if you need any kind of loans Email: pedroloanss@gmail.com Or Whatsapp: +18632310632

    ReplyDelete

If you have any doubt, please let me know.

Popular Posts