Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
allan8964
Posting Yak Master
249 Posts |
Posted - 2011-11-27 : 22:15:20
|
Hi people,I use flat file connection to import file to sql table. But the file names are with time stamps and the import is set automatically run. File name is like DD_Production_3-23-2011.txt. The file was produced daily so each day a new file with new date is there. How can I pick up the current day's file in file connection? Or do I need to run some other task to do this job? Thanks in advance. |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-28 : 03:32:12
|
you can add a script task to do that. Add a for each file loop to iterate through files in folder. Add a variable in package to hold filename for each iteration and also another variable to hold @[System::StartTime] value. Inside loop add a script task and inside that pass filename variable and starttime variable. then you can use vb.net function IndexOf to check for pattern of current date value inside filename variable. If found set a boolean variable to true else false. Then in precedence constraint for next task add constraint and expression option and give constraint as OnSuccess and Expression as @BooleanVariable == true------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|