cancel
Showing results for 
Search instead for 
Did you mean: 

How to count the non-skipped rows with INSERT ... ON EXISTING SKIP?

VolkerBarth
Contributor
2,841

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 12.0.0.2601.)

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Volker,

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.

Karim

Former Member

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

Answers (0)