dbTalk Databases Forums  

load csv file with SSIS

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


Discuss load csv file with SSIS in the microsoft.public.sqlserver.dts forum.



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

Default load csv file with SSIS - 05-26-2008 , 02:03 PM






I have a csv file with first 2 lines having less columns than all the rest of
the lines. The first line has 6 columns, the second line has 4 columns, then
all the rest of the lines have 14 columns. My destination table in sql
server also has 14 columns.

With the sql 2000 import and export wizard, I was able to load the whole
file without errors. The first 2 records would have null in the corresponding
missing columns.

I am not sure how to use SSIS to load the file the same way? The flat file
source object seems to be unable to ignore the missing columns in the first 2
lines? I have no control over the source file format as it was automatically
generated by another program that I have no access to. So I need to figure
out a way to load this file into sql server as is.

Reply With Quote
  #2  
Old   
jhofmeyr@googlemail.com
 
Posts: n/a

Default Re: load csv file with SSIS - 05-27-2008 , 07:57 AM






Hi Aki,

Do you need the first 2 lines? I'm assuming they contain some kind of
header information, and not actual data that has missing values?

If this is the case, you should be able to set your file connection to
ignore the first 2 lines of every file (with the skip header rows
property).

If these rows contain actual data, you will have to adjust your
package to handle ragged right file formats (google it, there should
be lots of hits). Or you could write a simple script task to add the
missing ","'s to the first two rows that would allow SSIS to detect
the missing columns as NULL's.

Good luck!
J

Reply With Quote
  #3  
Old   
jhofmeyr@googlemail.com
 
Posts: n/a

Default Re: load csv file with SSIS - 05-27-2008 , 07:57 AM



Hi Aki,

Do you need the first 2 lines? I'm assuming they contain some kind of
header information, and not actual data that has missing values?

If this is the case, you should be able to set your file connection to
ignore the first 2 lines of every file (with the skip header rows
property).

If these rows contain actual data, you will have to adjust your
package to handle ragged right file formats (google it, there should
be lots of hits). Or you could write a simple script task to add the
missing ","'s to the first two rows that would allow SSIS to detect
the missing columns as NULL's.

Good luck!
J

Reply With Quote
  #4  
Old   
jhofmeyr@googlemail.com
 
Posts: n/a

Default Re: load csv file with SSIS - 05-27-2008 , 07:57 AM



Hi Aki,

Do you need the first 2 lines? I'm assuming they contain some kind of
header information, and not actual data that has missing values?

If this is the case, you should be able to set your file connection to
ignore the first 2 lines of every file (with the skip header rows
property).

If these rows contain actual data, you will have to adjust your
package to handle ragged right file formats (google it, there should
be lots of hits). Or you could write a simple script task to add the
missing ","'s to the first two rows that would allow SSIS to detect
the missing columns as NULL's.

Good luck!
J

Reply With Quote
  #5  
Old   
jhofmeyr@googlemail.com
 
Posts: n/a

Default Re: load csv file with SSIS - 05-27-2008 , 07:57 AM



Hi Aki,

Do you need the first 2 lines? I'm assuming they contain some kind of
header information, and not actual data that has missing values?

If this is the case, you should be able to set your file connection to
ignore the first 2 lines of every file (with the skip header rows
property).

If these rows contain actual data, you will have to adjust your
package to handle ragged right file formats (google it, there should
be lots of hits). Or you could write a simple script task to add the
missing ","'s to the first two rows that would allow SSIS to detect
the missing columns as NULL's.

Good luck!
J

Reply With Quote
  #6  
Old   
jhofmeyr@googlemail.com
 
Posts: n/a

Default Re: load csv file with SSIS - 05-27-2008 , 07:57 AM



Hi Aki,

Do you need the first 2 lines? I'm assuming they contain some kind of
header information, and not actual data that has missing values?

If this is the case, you should be able to set your file connection to
ignore the first 2 lines of every file (with the skip header rows
property).

If these rows contain actual data, you will have to adjust your
package to handle ragged right file formats (google it, there should
be lots of hits). Or you could write a simple script task to add the
missing ","'s to the first two rows that would allow SSIS to detect
the missing columns as NULL's.

Good luck!
J

Reply With Quote
  #7  
Old   
jhofmeyr@googlemail.com
 
Posts: n/a

Default Re: load csv file with SSIS - 05-27-2008 , 07:57 AM



Hi Aki,

Do you need the first 2 lines? I'm assuming they contain some kind of
header information, and not actual data that has missing values?

If this is the case, you should be able to set your file connection to
ignore the first 2 lines of every file (with the skip header rows
property).

If these rows contain actual data, you will have to adjust your
package to handle ragged right file formats (google it, there should
be lots of hits). Or you could write a simple script task to add the
missing ","'s to the first two rows that would allow SSIS to detect
the missing columns as NULL's.

Good luck!
J

Reply With Quote
  #8  
Old   
jhofmeyr@googlemail.com
 
Posts: n/a

Default Re: load csv file with SSIS - 05-27-2008 , 07:57 AM



Hi Aki,

Do you need the first 2 lines? I'm assuming they contain some kind of
header information, and not actual data that has missing values?

If this is the case, you should be able to set your file connection to
ignore the first 2 lines of every file (with the skip header rows
property).

If these rows contain actual data, you will have to adjust your
package to handle ragged right file formats (google it, there should
be lots of hits). Or you could write a simple script task to add the
missing ","'s to the first two rows that would allow SSIS to detect
the missing columns as NULL's.

Good luck!
J

Reply With Quote
  #9  
Old   
jhofmeyr@googlemail.com
 
Posts: n/a

Default Re: load csv file with SSIS - 05-27-2008 , 07:57 AM



Hi Aki,

Do you need the first 2 lines? I'm assuming they contain some kind of
header information, and not actual data that has missing values?

If this is the case, you should be able to set your file connection to
ignore the first 2 lines of every file (with the skip header rows
property).

If these rows contain actual data, you will have to adjust your
package to handle ragged right file formats (google it, there should
be lots of hits). Or you could write a simple script task to add the
missing ","'s to the first two rows that would allow SSIS to detect
the missing columns as NULL's.

Good luck!
J

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.