dbTalk Databases Forums  

Dynamically importing flat file in SSIS

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


Discuss Dynamically importing flat file in SSIS in the microsoft.public.sqlserver.dts forum.



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

Default Dynamically importing flat file in SSIS - 10-19-2005 , 12:54 PM






Hi,

I'm "playing" around with SSIS and try to solve the following problem.

I've an import folder which is filled with CSV - files from a legacy app.
There can be up to 50 files in this folder. e.g. customer file, vehicle file
and the corresponding parameter files.
That means the structure of the each file is totally different, but all
files contain a header record with all the column names, which describes
their content.

I want to create a SSIS package which loops through all files and
dynamically creates a table for each file. The table name should be the name
of the file and the column names should be the ones from the header record
included in each file.

So I simply :-) need an automatic import of flat files into a db.

Using a ForEach Loop task and enumerating the files are quite easy, but I
don't know how to solve this dynamic creation of tables with a dynamic
structure taken from the corresponding CSV file.

Is there an "on-board" functionality in SSIS to solve this task, or do I
have to write a program or script.

Thanks in advance for you help

Uwe



Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Dynamically importing flat file in SSIS - 10-19-2005 , 01:30 PM






Hello Uwe,

Right the issue here is that unlike DTS, SSIS does not allow you to start
changing the pipeline (data) metadata willy nilly. The only way I can think
you would be able to do this is to basically rebuild the package on each
occasion. You would need to have an ExecuteSQL task to create the table
joined to the Data Flow Task and then build the MainPipe behind that.

Allan




Quote:
Hi,

I'm "playing" around with SSIS and try to solve the following problem.

I've an import folder which is filled with CSV - files from a legacy
app.
There can be up to 50 files in this folder. e.g. customer file,
vehicle file
and the corresponding parameter files.
That means the structure of the each file is totally different, but
all
files contain a header record with all the column names, which
describes
their content.
I want to create a SSIS package which loops through all files and
dynamically creates a table for each file. The table name should be
the name of the file and the column names should be the ones from the
header record included in each file.

So I simply :-) need an automatic import of flat files into a db.

Using a ForEach Loop task and enumerating the files are quite easy,
but I don't know how to solve this dynamic creation of tables with a
dynamic structure taken from the corresponding CSV file.

Is there an "on-board" functionality in SSIS to solve this task, or do
I have to write a program or script.

Thanks in advance for you help

Uwe




Reply With Quote
  #3  
Old   
Uwe Kuhne
 
Posts: n/a

Default Re: Dynamically importing flat file in SSIS - 10-20-2005 , 01:07 AM



Hello Allan,
thanks for you answer. I thought I've overlooked an easier way.
It's not really a big thing writing code for this functionality, but I
was interested if there would be a simple "drag and drop" alternative
within SSIS.

Uwe



*** Sent via Developersdex http://www.developersdex.com ***

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.