Discussion:
Importing several text file into several tables
(too old to reply)
Alain
2009-05-11 22:17:01 UTC
Permalink
Hello,

I have many text files on a folder with the same metadata and I need to
import each one into a separate table.
1. Is it possible to do this with using one package?
2. Is it possible to use the same package even if the format (metadata) of
the text files changes?
(the format of the files is not known but they have the same format)

Any help will be highly appreciated,

Thank you,
Alain
Todd C
2009-05-12 13:12:01 UTC
Permalink
Are you using SQL 2000 and DTS? If so, I can't help.

If you are using SQL 2005 or 2008 and SSIS, then it can certainly be done
using a For Each loop and some well designed variables. Check out my blog on
this particular subject at
http://toddchitt.wordpress.com/2008/11/04/ssis_flat_loop/
Feel free to leave a reply at WordPress and I'll try to respond personally.

You may need to enhnace that a little and also set the destination table
and/or destination ConnectionManager from a variable as well.

You say that the metadata of the source files might change? That will lead
to issues. How would you handle it if you package only processed one single
file?

=====
Todd C
Post by Alain
Hello,
I have many text files on a folder with the same metadata and I need to
import each one into a separate table.
1. Is it possible to do this with using one package?
2. Is it possible to use the same package even if the format (metadata) of
the text files changes?
(the format of the files is not known but they have the same format)
Any help will be highly appreciated,
Thank you,
Alain
Alain
2009-05-15 22:16:01 UTC
Permalink
Thanks Todd for your help.
I still have a problem. How can I import a file (onlu one) to a table, the
format of the file is unknown. For example I need to use the same pakage to
import:
File1
Id, name, address
File2
Code, Item ,Price, Quantity

So the problem is how can I create dynamically my destination table that
matches the format file to import?

Thanks
Alain
Post by Todd C
Are you using SQL 2000 and DTS? If so, I can't help.
If you are using SQL 2005 or 2008 and SSIS, then it can certainly be done
using a For Each loop and some well designed variables. Check out my blog on
this particular subject at
http://toddchitt.wordpress.com/2008/11/04/ssis_flat_loop/
Feel free to leave a reply at WordPress and I'll try to respond personally.
You may need to enhnace that a little and also set the destination table
and/or destination ConnectionManager from a variable as well.
You say that the metadata of the source files might change? That will lead
to issues. How would you handle it if you package only processed one single
file?
=====
Todd C
Post by Alain
Hello,
I have many text files on a folder with the same metadata and I need to
import each one into a separate table.
1. Is it possible to do this with using one package?
2. Is it possible to use the same package even if the format (metadata) of
the text files changes?
(the format of the files is not known but they have the same format)
Any help will be highly appreciated,
Thank you,
Alain
Loading...