I have an insert statement that extracts some data into several table variables, and then, based on this data, inserts several attachments into several tables. I only care about rows inserted into real tables, not table variables, but ExecuteNonQuery will return the sum of all @@ ROWCOUNT. I would like to know if there is a way to override the number of rows returned with ExecuteNonQuery?
I know that as an alternative, I can use ExecuteScalar or output variables.
Here is an example that reduces it to a simple example:
CREATE TABLE VersionExample ( Version Varchar(255) ) Declare @RowCountICareAbout int DECLARE @Example TABLE ( Version Varchar(255) ) INSERT INTO @Example Select @@VERSION INSERT INTO VersionExample SELECT Version FROM @Example SET @RowCountICareAbout = @@ROWCOUNT
source share