Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

How to parse a flat file with C#

$
0
0

I need to parse a flat file with data that looks like

01,1235,555
02,2135,558
16,156,15614
16,000,000

You get the idea. Anyway, I'd like to just used a derived column and move on except I need to put a line number on each row as it comes by so the end looks like,

1,01,1235,555
2,02,2135,558
3,16,156,15614
4,16,000,000

I'm trying to do with a script transformation but I can't seem to get the hang of the syntax. I've tried looking at various examples but everybody seems to prefer VB and I'd like to keep all of my packages C#. I've set up my input and my output columns I just need to figure out how to write the code that says something like:

row_number = 1

line_number = row_number
record_type = input.split.get the second data element
data_point_1 = input.split.get the third data element
...

row_number = row_number ++


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>