17nxo
17nxo

Reputation: 87

How to determine the last row of rowset for further processing during data flow?

I have a problem regarding SSIS 2014 data flow. I need to determine the last row of the rowset during the data flow. I need it for further processing inside the same data flow. Using the script component, I tried the functions NextRow() and EndOfRowset(). However, these functions are not working reliable using the following code:

public override void Input0_ProcessInputRow(Input0Buffer Row)
{
    if (!Row.NextRow()) // never true.
    {
        MessageBox.Show("last row");
    }

    if (Row.EndOfRowset()) // never true.
    {
        MessageBox.Show("last row");
    }
}

the reasons are some buffer size issues as you can read here: http://social.msdn.microsoft.com/Forums/sqlserver/en-US/b07c5324-56ff-48dc-991c-3947aecf1558/endofrowset-doesnt-work?forum=sqlintegrationservices

So I tried to measure the number of rows so that I could determine the last row. Unfortunately the row count transformation assigns the determined row count to the variable when all rows are processed. So I can't use it during the data flow.

How can I determine the last row during the data flow so that I can process this row individually?

Upvotes: 1

Views: 2725

Answers (1)

jymbo
jymbo

Reputation: 1375

You're going to want to do this in the Input0_ProcessInput method. Try testing out this code in your script component:

public override void Input0_ProcessInput(Input0Buffer Row)
    {
        base.Input0_ProcessInput(Row);

        //Will be true this time
        if (Row.EndOfRowset())
        {
            MessageBox.Show("Last Row");
        }
    }

Upvotes: 4

Related Questions