问题
I am trying to import different csv files from a folder containing different csv file types. So I need to filter my foreach loop with the starting flatfile name. I only want to process files starting with MyFileType_1*.csv and not the others in the same folder. Any suggestion is welcome, thanks.
回答1:
In your for-each container can specify which files to read as Ocaso is saying. In the Variable mappings tab in the for-each container you can there set which variable you want to save the files found. Then you can use this variable as the connection string to a flat file connection.
回答2:
Nighty_'s answer is correct, but just for the sake of completeness it is worth mentioning that to set the ConnectionString
in a Flat File Connection you must use a variable of package-level scope in the expression (in his case @[User::v_FilePath]
). This is because the connection itself is package level. This might feel a bit unintuitive... or ugly... it is.
来源:https://stackoverflow.com/questions/19243893/ssis-foreach-loop-with-specific-flat-files