Michael Covington (4/3/2008)
I have a variable length flat file that is defined by a "record type" value (first two characters in each row), for example:01value1value2value3valueINEEDvalue4value5
02newval1newval2newval3
03anotherval1
04differentval1differentval2differentval3differentval4differentval5differentval6
I can read the source file using a "flat file source", use a "script component" to break the file row into 2 columns ( rectype and rowdata), I can then use a "conditional split" to push the data to different destination sources (tables - flat files).
The problem is that the file has to be processed sequentially, there is a value, or column, in the "01" record type rows that I need to relate the following record type rows to the "parent" (01 record type rows). How can I grab a value from one column in the "01" type rows, and add that value as an new column in the Non 01 rows?
column I need is listed as "valueINEED"
example output:
01value1value2value3valueINEEDvalue4value5
02newval1newval2newval3valueINEED
03anotherval1valueINEED
04differentval1differentval2differentval3differentval4differentval5differentval6valueINEED
You don't necessarily need a script for that. Assuming there's a way to identify the pattern (your test data doesn't give me a hint on how to), take a look at what I posted over in this thread.
http://www.sqlservercentral.com/Forums/FindPost478822.aspx
You can then use the derived column transform to parse the stuff, and then your data "stays" with the identity column.
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?