sameer sawant
sameer sawant

Reputation: 69

how to count number of rows inserted or updated in SSIS

I have a ssis project used to inserting large number of rows from table or excel sheet in a table.i want to know how many number of rows are inserted in table while my project is running which function I need to use.

Upvotes: 3

Views: 6180

Answers (1)

user2460074
user2460074

Reputation: 1272

The best way to do this is using the ROW COUNT :

Firstly create a variable in your package in my case i called the variable ROWNUM

Secondly add the component ROW COUNT in your data flow see the picture as bellow :

ROW COUNT Component

Double click in the Row count component and in Component properties tab go to Variable Name and select your variable.

Thirdly add a script task see the picture as bellow

Script task

Double click in the Script task component and you will see ReadonlyVariable and select your variable then click in the Edit script you will see a Main method and write the line code as bellow :

 public void Main()
        {
            // TODO: Add your code here
            Dts.TaskResult = (int)ScriptResults.Success;
            MessageBox.Show("Rows inserts are "+Dts.Variables["User::ROWNUM"].Value.ToString()+" rows ");
        }

Upvotes: 2

Related Questions