The forum will experience an outage sometime between February 10 at 7:00pm EST and February 12 at 11:59 EST for installation of security updates. The actual time and duration of the outage are unknown but attempts will be made to minimize the downtime. We apologize for any inconvenience.

As documented, when using INSERT ... ON EXISTING SKIP, the value of @@ROWCOUNT still does count all rows from the source table:

Rows that are skipped are included in the @@rowcount variable. See @@rowcount global variable.

Is there a possibility to get only the count of the really inserted rows (besides merely counting the tables's rows before and after the statement)?

If not, is this considered as a future enhancement?

(FWIW, I'm using SA

asked 20 Jan '11, 10:04

Volker%20Barth's gravatar image

Volker Barth
accept rate: 32%


The enhancement you are suggesting seems quite reasonable if you are using "EXISTING SKIP" since the @rowcount is supposed to be the number of rows affected. I will open an enhancement request and we will try and get the enhancement in place for a future release.


permanent link

answered 20 Jan '11, 15:16

Karim%20Khamis's gravatar image

Karim Khamis
accept rate: 40%


Just to follow up, this "bug" has now been fixed. The fix has been put into, and

(24 Jan '11, 12:23) Karim Khamis
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 20 Jan '11, 10:04

question was seen: 850 times

last updated: 20 Jan '11, 15:16