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 |
NguyenL71
Posting Yak Master
228 Posts |
Posted - 2011-08-24 : 11:26:40
|
[code]I need to import 5 text files into 5 different tables and each text file has different dataex:File1.txt ----> table1......File5.txt ----> table5.I look into ForEach loop but it loop through all the text files have the same data andimport in a single table but I need to import into 5 different tables. I also look intoKnight's 24 hour Trainer MS SQL 2008 SSIs but no help. Does anyone know where I canI find the similar project on the web site which can help me to complete the task.I also look into the following sites:http://www.sqlis.com/sqlis/http://www.bigresource.com/Tracker/Track-ms_sql-ixwUDGqd/http://blogs.lessthandot.com/index.php/DataMgmt/DBAdmin/title-12Any help would greatly appreciate.[/code] |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-24 : 12:22:34
|
do you mean file structures vary? if yes, i think there's no possibility of using loop as it cant change metadata at runtime.Only other option is to use script task where you create an object for filesource and table destination at runtime and refresh metadata each time.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
mandm
Posting Yak Master
120 Posts |
Posted - 2011-08-24 : 13:22:01
|
Why not just use 5 dataflow tasks from the text files to their respective tables? |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-24 : 13:33:19
|
thats the usual way but OP was trying to implement using a for loop------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
mandm
Posting Yak Master
120 Posts |
Posted - 2011-08-24 : 13:38:40
|
It didn't seem to me that the For Loop was a requirement. Just getting the 5 text files into the tables. I guess the OP will tell us. |
|
|
NguyenL71
Posting Yak Master
228 Posts |
Posted - 2011-08-24 : 18:42:24
|
[code]Thanks for your reply but the text files and the tables structure are different. I need to clean up the data before it get into staging db.It's not straight import into the tables. Thanks.[/code]quote: Originally posted by mandm It didn't seem to me that the For Loop was a requirement. Just getting the 5 text files into the tables. I guess the OP will tell us.
|
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-25 : 01:54:10
|
thats ok. you can cleanse by putting them to corresponding staging tables and then taking from there------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|