February 21, 2012 at 3:37 am
I'm trying to automate the import of a number of flat files in to a SQL database. Searching on the web I came a cross the FOREACH loop, but the examples I find only seem to cater for multiple flat files importing in to one single table.
What I need is each flat file to create it's own table.
For example the data folder will contain numerous .txt files, AjDetails.Txt, AjTotals.Txt,AjDescs.Txt. What I want the loop to do is to take each of these files and create a new table so in this example I'd end up with 3 new tables AjDescs, AjTotal & AjDetail. Is this possible?
March 9, 2012 at 4:17 am
ron.grace (2/21/2012)
I'm trying to automate the import of a number of flat files in to a SQL database. Searching on the web I came a cross the FOREACH loop, but the examples I find only seem to cater for multiple flat files importing in to one single table.What I need is each flat file to create it's own table.
For example the data folder will contain numerous .txt files, AjDetails.Txt, AjTotals.Txt,AjDescs.Txt. What I want the loop to do is to take each of these files and create a new table so in this example I'd end up with 3 new tables AjDescs, AjTotal & AjDetail. Is this possible?
I don't say this would be the better idea, But for now, this is what i thought of using for loop and flat source to get the files, and use a script component to get the rows and write codes to create table with file name(to get file name, use variable) and insert the rows into the table.
Sorry , If it is not a good process.
Thanks,
Charmer
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply