RecheckRows

Description

Rechecks the number of rows affected by an INSERT, UPDATE, or DELETE command and returns it in the SQLNRows property of the Transaction object.

Applies to

ADO.NET

OLE DB

SNC SQL Native Client for Microsoft SQL Server

MSOLEDBSQL Microsoft OLE DB Driver for SQL Server

Syntax

RecheckRows=value

Parameter

Description

value

Specifies whether the value of the Microsoft SQL Server @@rowcount property is checked and returned in the SQLNRows property of the Transaction object. Values are:

  • 0

    (Default) Do not recheck the count of affected rows.

  • 1

    Recheck the count of affected rows.


Default value

RecheckRows=0

Usage

In Microsoft SQL server, if a table has an insert, update, or delete trigger, the number of affected rows returned to the SQLNRows property of the Transaction object after an INSERT, UPDATE, or DELETE command depends on the driver. With an ADO.NET driver, the value returned is the sum of the rows affected by the command itself and the trigger.

When you are connected to Microsoft SQL Server using ADO.NET or OLE DB, you can set the RecheckRows runtime database parameter to 1 to recheck how many rows of data were affected by the INSERT, UPDATE, or DELETE command itself and return that value in the SQLNRows property.

Setting RecheckRows to 1 before issuing an INSERT, UPDATE, or DELETE command causes a SELECT @@ROWCOUNT command to be executed. To improve performance, you should set it only when required, and reset it to the default value of 0 after use.

Examples

To set RecheckRows to 1, type the following in code:

SQLCA.DBParm="RecheckRows=1"