简体   繁体   中英

SSIS Wildcard Flat file connection

I want to load data from some csv files in a certain directory into a sql server table. The files are in the following format File_DDMMYYYHHMMSS.csv however I only want to select the files from the current day, the time doesn't matter. Is there a way to search files in this way? I have tried using a foreach loop and looking for only *.csv and setting a variable and then using:

LEFT(  @[User::FileName],5 ) +  
RIGHT("0" + (DT_WSTR,2)DatePart("dd", GetDate()), 2) +
RIGHT("0" + (DT_WSTR,2)DatePart("mm", GetDate()), 2) + 
RIGHT((DT_WSTR, 4) DATEPART("yyyy", GetDate()), 4)

What i need is something like :

@filename + Todays date + " __ "

Doing a quick google search yielded this link that explains the exact method of doing this. Its a dirty version of doing stuff, but gets the job done effectively.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM