Return Total of Insertions

  • Hi,

    I have a stored procedure where I need to insert data into a table. I need to know how to get the total of records inserted into the table.

    eg :

    Insert Table1

    Select * from Table2

    I dont want to use the Select count(*) from Table1 because the table has an Ignore Duplicate Key ON and the total of records inserted are around 80millions records.

    Is any SQL command I can use to get the total of records inserted? any advice?

    Regards,

  • Check out @@rowcount in books online. Just make sure you run it right after your insert statement. If you aren't doing the insert in 1 transaction this probably won't work.

  • Thank you so much. I perfectly works for what I need.

    Regards,

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

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