Generic file name for delimited source file
Dear All
Finance department has come up with the requirement to load a delimiter file s but mostly they will date (YYYYMMDD) appended to file so that they can keep the track and want to load it without changing name. E.g.
For Jan 2011
US Local data file on 1-Jan-2011 will be: Us_local_20110101.csv
UK Local data file on 1-Jan-2011 will be: Uk_local_20110101.csv
For Feb 2011
US Local data file on 1-Feb-2011 will be: Us_local_20110201.csv
UK Local data file on 1-Feb-2011 will be: Uk_local_20110201.csv
And so on
What I was looking for is a technique where
I can load the file by specifying the names like ‘Us_local_*.csv’ and ‘Uk_local_*.csv’
Additionally if I can read the latest file for each category then I can keep the previous file in the directory rather than deleting it from the folder to have the latest files only.
Please adviseDigitalFM
January 31st, 2011 10:20am
Doesn't make sense for me clearly.
do you want to load these data into same table? or different table per each country and date?
http://www.rad.pasfu.com
Free Windows Admin Tool Kit Click here and download it now
January 31st, 2011 10:27am
Do you intend to pick all the files for US or UK? or do you want to pick the latest file for any specific country? and yes then load the data to one table?
January 31st, 2011 10:38am
I want to load only the latest files each of UK and US and load in the separate tables i.e different table for each country data
DigitalFM
Free Windows Admin Tool Kit Click here and download it now
January 31st, 2011 10:48am
what about structure of data?
I mean is the structure of file and table differs for 'us' and 'uk' ?http://www.rad.pasfu.com
January 31st, 2011 11:31am
Have a look at my
blog for some ideas.
Free Windows Admin Tool Kit Click here and download it now
January 31st, 2011 11:43am
When loading the files in SSIS, you can have two data flow tasks which have a different file-iterating Foreach loop in them.
The first foreach loop would use the filter Us_local_*.csv and the second would use Uk_local_*.csv
See http://www.sqlis.com/post/Looping-over-files-with-the-Foreach-Loop.aspx for screenshots and examples
January 31st, 2011 11:47am
this method will find last created file in the special directory, you don't event need to use foreach loop, just use script task.
http://www.rad.pasfu.com/index.php?/archives/30-Find-Last-Created-File-in-Special-Directory-SSIS.htmlhttp://www.rad.pasfu.com
Free Windows Admin Tool Kit Click here and download it now
January 31st, 2011 11:57am
Yes structure is differnent beccase of regional requirements (European Union , USA)DigitalFM
January 31st, 2011 12:06pm
Yes structure is differnent beccase of regional requirements (European Union , USA)
DigitalFM
In that case you cannot use any of the suggested methods. The data flow task is not designed for dynamic metadata.
Free Windows Admin Tool Kit Click here and download it now
January 31st, 2011 3:42pm
Yes structure is differnent beccase of regional requirements (European Union , USA)
DigitalFM
In that case you cannot use any of the suggested methods. The data flow task is not designed for dynamic metadata.
January 31st, 2011 3:42pm
you can use two separate dataflows with different mappings from separate directories or with different filters as mentioned above
Free Windows Admin Tool Kit Click here and download it now
January 31st, 2011 7:10pm
you can use two separate data flows, as I think you are doing this already. but for finding last file of each data flow source go with my previous posted link.
let us know if you have any problem.http://www.rad.pasfu.com
February 1st, 2011 2:12am
Hi Raza
Yes I am using two separate data flows. I have see your link and I hope it will do what i am looking for but i am not sure where i should put that c~ code becase i have not work on this part of SSIS.
Please advise
DigitalFM
Free Windows Admin Tool Kit Click here and download it now
February 1st, 2011 5:38am
http://chanmingman.wordpress.com/2009/05/06/write-a-%E2%80%9Chello-world%E2%80%9D-in-ssis-sql-server-integration-services-using-c/DigitalFM
February 1st, 2011 5:46am