SSIS "Foreach Loop container _foreach File Enumerator" (The contents of all TXT files under the import path) (GO)

Source: Internet
Author: User
Tags ole ssis

Original: http://blog.csdn.net/kk185800961/article/details/12276449

SQL Server R2

Ssis_foreach Loop Container _foreach File Enumerator (the contents of all TXT files under the import path)


1. Drag a Foreach Loop container to control flow, and then drag a data Flow task into the Foreach Loop container.



2. Edit the Foreach Loop container, select the Foreach file enumerator in the Options collection, and configure the folders and file types to traverse.



3. Add a traverse to the option "variable mapping", which is used to store the full path of the file each time the container traverses.



4. OK, the "Foreach Loop Container" configuration is complete and the data flow is now designed. Add a "Flat File source" and "OLE DB destination" to the data flow interface to connect the data flow.



5. Edit the Flat file source and create a new flat Connection Manager to find any file in the TXT directory (as all TXT file content formats)



6. In the "column" Selection of the format, I tested only two columns. After completion, you can set the name of the output in another "column" in the outer layer.




7. After the OLE DB destination defines the database connection, I import the data into a new table in the database. First click on "New" a table, OK after the database in the new.



8. Two data sources when selected, right-click the Txtsource property and select the button to the right of Expressions.



9. Attribute Select "ConnectString", the expression selection button, find the previously defined file variables, drag the mouse to the following text box, OK!



10. At this point, the design is complete, now run, the result, the program runs 5 times, 1 lines at a time. I tested one record per file, so there were only 5 entries.




Complete!

SSIS "Foreach Loop container _foreach File Enumerator" (The contents of all TXT files under the import path) (GO)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.