stexcec
stexcec

Reputation: 1163

SSIS 2005 - how to skip rows from input flat file programmatically

I need to import a .csv file into a SQL table.

The input file looks like:

gru,212,BNP10H,bnp10h,1,01,Gestore 01
limGru,2012-09-12,17:21:05,kair103,,,,
limGru,2012-10-19,09:45:03,kair028,,,,
limGru,2012-10-19,09:45:06,kair028,,,,
limGru,2012-10-19,09:45:14,kair028,,,,
gru,207,BNP50E,bnp 50 equity,1,01,Gestore 01
limGru,2012-09-13,11:49:58,kair022,,,,
limGru,2012-10-05,15:20:11,kair048,,,,
limGru,2012-10-17,09:23:14,kair048,,,,

and i would import only the rows that begin with "limGru".

Any idea in how to implement my task?

EDITED: please note that the rows have different number of columns, depending on the first filed ("gru" or "limGru")

EDITED 2: Please also take a look here:

SSIS =- How to process an CSV input file with a variable number of columns based on record type (Header, Detail, Trailer)

Upvotes: 0

Views: 5288

Answers (2)

Piotr Sobiegraj
Piotr Sobiegraj

Reputation: 1783

If limGru is fixed value? If so then you can do Conditional split with condition [NameOfYourFirstColumn] == "limGru"

Upvotes: 0

Debura
Debura

Reputation: 509

Import all data from the flat file and then use the conditional split transformation. If you're not familiar with the transformation follow the link below: http://technet.microsoft.com/en-us/library/ms137886(v=sql.90).aspx

Upvotes: 1

Related Questions