Friday, March 9, 2012

row by row reading of textfile

hi,

how do i do in ssis if i want to read the textfile row by row? i need to do this since every line in my flat file has different conditions to fulfill depending on the content of the row.

cherriesh

Have you tried using the flat file source? Perhaps treat the file as delimited, but just have one column, and the row being delimited by a carriage return.

You could also write your own source by using the sript component. Here you can just use the power of VB.Net to open the file, and then read each line as you requie. Pass out data as and when you want. SQL Server Books Online includes topic on how to "Creating a Source with the Script Component", complete with an example titled "Flat File Source Example".

|||

Take a look at this thread: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1568089&SiteID=1

I posted an example on my blog : http://agilebi.com/cs/blogs/jwelch/archive/2007/05/08/handling-flat-files-with-varying-numbers-of-columns.aspx

Jamie has also pointed out that this can be done without the script task, by using the derived column transform and a conditional split.

No comments:

Post a Comment