dbTalk Databases Forums  

Importing several text file into several tables

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Importing several text file into several tables in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Alain
 
Posts: n/a

Default Importing several text file into several tables - 05-11-2009 , 05:17 PM






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

Reply With Quote
  #2  
Old   
Todd C
 
Posts: n/a

Default RE: Importing several text file into several tables - 05-12-2009 , 08:12 AM






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/...sis_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


"Alain" wrote:

Quote:
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

Reply With Quote
  #3  
Old   
Alain
 
Posts: n/a

Default RE: Importing several text file into several tables - 05-15-2009 , 05:16 PM



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

"Todd C" wrote:

Quote:
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/...sis_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


"Alain" wrote:

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

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.