Book Image

Microsoft SQL Server 2014 Business Intelligence Development Beginner's Guide

By : Abolfazl Radgoudarzi, Reza Rad
Book Image

Microsoft SQL Server 2014 Business Intelligence Development Beginner's Guide

By: Abolfazl Radgoudarzi, Reza Rad

Overview of this book

Table of Contents (19 chapters)
Microsoft SQL Server 2014 Business Intelligence Development Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – looping through CSV files in a directory and loading them into a database table


In this example, we will use the Foreach Loop container to loop through files in a directory, and then we will set the connection manager of the source file dynamically in the flat file source, and load the content of the source file into the destination database table. Then, we will write a log entry into the database with the name of the file and load date time. For this example, we use packages and tasks that we developed in the last two examples:

  1. Create a new SSIS package and name it Master Package. Drag-and-drop a Foreach Loop container in Control Flow.

  2. Create a variable with a string type and name it FilePath.

  3. Double-click on the Foreach Loop Container. In the Foreach Loop Container Editor, set Enumerator as Foreach File Enumerator.

  4. In the Enumerator configuration, set the source directory to the path of the directory that contains Customers CSV files. Leave other settings as they are:

  5. Go to...