Getting the file names each it time it loop through the file into the column name in ssis

I am trying to create an ssis package trying to pull the data from teh csv files into the oracle tables.




I am trying to get 6 files from the local C drive and it has files such as
 

Ohio_tp_data_inlab2.et.ky.micro.com_2011-10-18.csv


Ohio_tp_data_loulab2.et.ky.micro.com_2011-10-18.csv


Ohio_tp_data_emrvill2.et.ky.micro.com_2011-10-18.csv


Ohio_tp_data_crrwo12.et.ky.micro.com_2011-10-18.csv



Ohio_tp_data_logicall2.et.ky.micro.com_2011-10-18.csv


what i need to do is i need to loop through the files and get teh file name into the variable each time we loop through the file and get the column name into one of the "TargetSource" field that I have in the table.
So each time I looop through the data from the csv file I need to get the filename into the column along with the data.

and then the second file .... had to do the same thing get teh file name along with other column values and so on...

Like wise for all teh 6 files.  

So that when the data is loaded into the table I can check using the source which represents the filename.

srionline2k6Asked:
Who is Participating?
 
Alpesh PatelAssistant ConsultantCommented:
0
 
Alpesh PatelAssistant ConsultantCommented:
0
 
srionline2k6Author Commented:
Thank you Patel...I am still not able to figure out wher I am going wrong.

This is what I did:

Please correct me where I’m going wrong:
1   I dragged a forloop task and configured the enumerator as following:

 
2 file
Then I did the variable mapping as follows:  This variable is used for getting the file name and also connecting it to the connection manager (Correct me if I wrong)
Q: What this variable actually do ?  I guess it will grab the filename (Correct me if Iam wrong)


3rd file Note: But This variable is also used in mapping the flat file directory to the connection manager passing folder dynamically.
For dynamically passing the flat file connection I am connecting the connection manager to the variable  I have declared  a variable for receiving the file ( I have a doubt do we need to pass the same variable that I am using it to collect the file name


4th file:

I put the Dataviewer in the dataflow task after the derived column where I am pulling the filename
 


Finally the package is failing because of Null constraint as the table doesn’t permit null values.



     Forloop variable mapping variable mapping1-For-loop.png
3-Propertyexpressions.png
0
 
srionline2k6Author Commented:
Sorry THe above one is submitted incompletely not in a proper way

Thanks Patel !!

This is what I did:

Please correct me where I’m going wrong:
1   I dragged a forloop task and configured the enumerator as following:

 
2 file
Then I did the variable mapping as follows:  This variable is used for getting the file name and also connecting it to the connection manager (Correct me if I wrong)
Q: What this variable actually do ?  I guess it will grab the filename (Correct me if Iam wrong)


3rd file Note: But This variable is also used in mapping the flat file directory to the connection manager passing folder dynamically.
For dynamically passing the flat file connection I am connecting the connection manager to the variable  I have declared  a variable for receiving the file ( I have a doubt do we need to pass the same variable that I am using it to collect the file name


4th file:

I put the Dataviewer in the dataflow task after the derived column where I am pulling the filename
 


Finally the package is failing because of Null constraint as the table doesn’t permit null values. Forloop variable mapping Propertyexpressions Derived column for getting the filename\


Help me where I am going wrong. What will be the suggestions?

Thanks
5-dataviewer.png
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.