The SQL Server Native Client ODBC driver extends SQLGetStmtAttr to expose driver-specific statement attributes.
SQLSetStmtAttr lists statement attributes that are both read and write. This topic lists the read only statement attributes.
The SQL_SOPT_SS_NCOUNT_STATUS attribute indicates the current setting of the NOCOUNT option, which controls whether SQL Server reports the numbers of rows affected by a statement when SQLRowCount is called. The ValuePtr value is of type SQLLEN.
NOCOUNT is OFF. SQLRowCount returns number of rows affected.
NOCOUNT is ON. The number of rows affected is not returned by SQLRowCount and the returned value is 0.
If SQLRowCount returns 0, the application should test SQL_SOPT_SS_NOCOUNT_STATUS. If SQL_NC_ON is returned, the value of 0 from SQLRowCount only indicates that SQL Server has not returned a row count. If SQL_NC_OFF is returned, it means that NOCOUNT is off and the value of 0 from SQLRowCount indicates that the statement did not affect any rows.
Applications should not display the value of SQLRowCount when SQL_SOPT_SS_NOCOUNT_STATUS is SQL_NC_OFF. Large batches or stored procedures can contain multiple SET NOCOUNT statements, so it cannot be assumed that SQL_SOPT_SS_NOCOUNT_STATUS remains constant. This option should be tested each time SQLRowCount returns 0.
SQLGetStmtAttr can be called to get the value of SQL_SOPT_SS_PARAM_FOCUS in the application parameter descriptor (APD) when working with table-valued parameters. For more information on SQL_SOPT_SS_PARAM_FOCUS, see SQLSetStmtAttr.
For more information about table-valued parameters, see Table-Valued Parameters (ODBC).