Hello,
I want to set up a Foreach loop container to loop through several flat files. I have a connection manager set up for individual flat files. The metadata for the files is all the same. They are fixed width files, and contain sixty five columns.
I didn't see a place in the container properties to configure the metadata of the files. How can a Foreach Loop Container 'know' the metadata of the flat files that I want to loop through?
Thank you for your help!
cdun2
If you are going to iterate through a number of files, you need t use a ForEach loop container that uses file enumerator . Then you need to create a single data flow with a single Flat file connection manager (using an expre ssion in the connection manager will do the trick of changing the name of the file on each iteration).
The metadata of the file has nothing to do with the ForEach loop container (It is defined in the connection manager though).
|||cdun2, Jamie Thomson has some great examples of SSIS on his blogs page. This one refers to enumerating files using a ForEach Loop container (not quite exactly what you are attempting to do, but gives you an Idea of how to use the foreach container.
http://blogs.conchango.com/jamiethomson/archive/2005/05/30/1489.aspx
Can you outline your process? If you are going to do processing on each flat file, you probably want the processing within the ForEach loop.
|||
Actually, here is another example:
http://www.sqlis.com/55.aspx
|||Thank you for your input! I'll see if I can run with the resources you have provided here.
cdun2
|||Another approach is to use a multi flatfile connection.
To use that you need to create a connection string with all the filenames concatenated with a "|" (pipe). You just use it as if you are loading a single flatfile into a table. It also lets you add the filename as a column so that you know what file a particular row is coming from.
Check it out.
|||I tried to implement this by following SSIS Tutorial Lesson 2 and the pkg only processed the last file in the list. From one I can tell from the project log, it didn't even loop through the other files, though it did process the last file by inserting its rows into the table, as expected.
Any ideas on why this would be happening? It seems like such a simple example... Thanks.
No comments:
Post a Comment