SSIS - simple way to get number of rows in result set

  • My execute sql task returns a "full result set" which I store in an Object objResults. I want a simple way to get the number of rows in objResults. How do I do it ? I want to use c# code to get that number.

    I could load the whole objResults into a DataTable and get the numberOfRows with myDataTable.Rows.Count;, but that approach is obviously inefficient.

    A bit of information about my code - An execute sql task simply puts all the records into a recordset, ADO i think. Then a script task reads it and loads it into a database. There is no data flow at all. All control flow tasks only - so row count transform will not work. Any simple C# code ?

  • I won't write the C# for you, but it's not too difficult. Google should be helpful in this situation.

    Personally, unless you need to do other work in the Script Task, I would simply add a 2nd Execute SQL Task. Modify your 1st query to pull a count, and store the result in an SSIS variable.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply