I'm need to collaspe a few rows together and output one row per group. The rows come from a flat file and are already sorted by orderid. Basically these are transactions with just the changed fields in them all unchanged fields are null (blank). They need to collapsed down to show the final state of all changed fields per order. Obviously the aggregate transform won't work in this situation since the goal is to collaspe instead of aggregate. In a language, I would normally buffer the previous row and apply the logic as needed until the orderid changed and then write out the new row. Then input file has millions of rows so I also didn't want to cursor through it updating individual rows in a table.
Example:
Orderid StatusCd OrderDt OrdrAmt
1 A 01/01/06 10
1 B
2 X 02/02/06 20
3 03/03/06 30
3 03/04/06
Collapse as
1 B 01/01/06 10
2 X 02/02/06 20
3 03/04/06
Danny,
The logic that you say you would apply in a programming language can be applied in exactly the same in SSIS by using a script component. I recommend you take a look at building an asynchronous script component.
-Jamie
No comments:
Post a Comment