Skip to content

Latest commit

 

History

History
61 lines (47 loc) · 3.77 KB

File metadata and controls

61 lines (47 loc) · 3.77 KB

title: "SQLGetStmtAttr | Microsoft Docs" ms.custom: "" ms.date: "03/14/2017" ms.prod: "sql" ms.prod_service: "database-engine, sql-database, sql-data-warehouse, pdw" ms.service: "" ms.component: "native-client-odbc-api" ms.reviewer: "" ms.suite: "sql" ms.technology:

ms.tgt_pltfrm: "" ms.topic: "reference" apitype: "DLLExport" helpviewer_keywords:

  • "SQLGetStmtAttr function" ms.assetid: e64f4f94-eb73-4477-9745-080b6cbdc751 caps.latest.revision: 43 author: "MightyPen" ms.author: "genemi" manager: "craigg" ms.workload: "Inactive" monikerRange: ">= aps-pdw-2016 || = azuresqldb-current || = azure-sqldw-latest || >= sql-server-2016 || = sqlallproducts-allversions"

SQLGetStmtAttr

[!INCLUDEappliesto-ss-asdb-asdw-pdw-md] [!INCLUDESNAC_Deprecated]

The [!INCLUDEssNoVersion] 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.

SQL_SOPT_SS_CURRENT_COMMAND

The SQL_SOPT_SS_CURRENT_COMMAND attribute exposes the current command of a command batch. The return is an integer that specifies the location of the command in the batch. The ValuePtr value is of type SQLLEN.

SQL_SOPT_SS_NOCOUNT_STATUS

The SQL_SOPT_SS_NOCOUNT_STATUS attribute indicates the current setting of the NOCOUNT option, which controls whether [!INCLUDEssNoVersion] reports the numbers of rows affected by a statement when SQLRowCount is called. The ValuePtr value is of type SQLLEN.

Value Description
SQL_NC_OFF NOCOUNT is OFF. SQLRowCount returns number of rows affected.
SQL_NC_ON 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 [!INCLUDEssNoVersion] 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.

SQL_SOPT_SS_QUERYNOTIFICATION_MSGTEXT

The SQL_SOPT_SS_QUERYNOTIFICATION_MSGTEXT attribute returns the message text for the query notification request.

SQLGetStmtAttr and Table-valued Parameters

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

See Also

SQLSetStmtAttr Function
ODBC API Implementation Details