Foreach loop expression

  • Hi i've about 10 files i get daily the file names are as follows

    xxx_20081202_A.txt

    xxx_20081202_B.txt

    xxx_20081202_C.txt

    xxx_20081202_D.txt

    I have the files all importing into the table but i like to add a column to the table and populate it with part of the file name that part of the file name i want to use is the A, in this file name acb_20081202_A.txt and the the B in this file name xxx_20081202_B.txt and so on for the rest of the files..

    Has anyone got any idea on how to go about this ?

  • You should be able to just use substring against the variable containing the file name in a derived column task in the dataflow. It should be available in the dataflow since that is within the for each.

  • Hey yes i was working with this concept but the problem am having is that i can't substring the file name.

    I can get it to work for any letters in the path up to c:\sampleafilesas soon as i select a letter from the file name the ssis package fails.

    c:\sampleafiles\xxx_20080212_A.txt

    substring([@user:files],30,1)

    I found out the prodblem its the data type which was set as the default was incorrect i had to change this to string DT_STR

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply