|As I explained earlier about Foreach Loop Container. One of regular reader of blog send me an email about one issue.|
Let me share that problem with all readers.
With this example, Foreach Loop Container, What to do if we want to save file name along with each row, so we can come to know that which row is from which file ?
This is very practical problem that we need to fix.
To solve this, I come up with following solution.
1. I used "Derived Column", one of Data Flow Transformations in Data Flow Operations.
2. Configure Derived Column:
As we have variable, FileName, as defined in, SQL SERVER: SSIS - Foreach Loop Container. Here I used that variable as a new column. By dragging that User variable to Expression.
By default it assign UNICODE STRING DataType to this new column. We need to change it by:
A. Right click on "Derived Column", Go to Show Advanced Editor
B. Set DataType to String as:
3. That's it. Now just add it to Destination Column Mapping with your Database column.
Let me know your suggestions.