Import multiple Files where fileName changes
I have multiple files that I need to import into the database, where the filename changes, but I also need to derive from the filename the date. So an example: 20101121.txt, 20101120.txt are the names of the files. These files are generated daily, but get imported once a week. How do I create a file connection to handle for the change in file names as well as importing multiple files? And question two is, I need to extract the date from the file name (11-21-2010; 11-20-2010) and w/ the data in the file, import the date. So if these files contained 3 rows (url, useragent, browsertype), i'd like to concatenate the Filename converted to a data format (URL,UserAgent,browserType,Date). How can that be done also? Thanks,
November 22nd, 2010 11:53am

This article must give you good directions: http://www.sqlis.com/post/Looping-over-files-with-the-Foreach-Loop.aspxArthur My Blog
Free Windows Admin Tool Kit Click here and download it now
November 22nd, 2010 12:08pm

1- How to loop through files check http://plexussql.blogspot.com/2009/10/how-to-loop-through-files-in-ssis.html 2- once you get the idea check http://plexussql.blogspot.com/2010/06/looping-through-csv-files-using-ssis.html you must change the *.csv files to *.txt in the variables and offcource the connection setting for the file 3- to get the file name you can add a script and check the name , or strip off the date or the name part see step 10 and see how i find the file name and add a date to it, you need to find a date , i am sure you will know how. 4- Q: These files are generated daily, but get imported once a week. How do I create a file connection to handle for the change in file names as well as importing multiple files? A: see blog http://plexussql.blogspot.com/2010/06/looping-through-csv-files-using-ssis.html the question is that will they be loaded once? if so and the system is automated then thats good if not and you have to check that , you need to keep track of the file names and date in a table to check if it has been loaded or not, but the second question is how will you reload if needed? Sincerely SH -- MVP, MCITP 2008, MCTS 2008 & 2005 -- Please kindly mark the post(s) that answered your question and/or vote for the post(s).
November 22nd, 2010 12:35pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics