共用方式為


SQLGetStmtAttr

The SQL Native Client ODBC driver extends SQLGetStmtAttr to expose driver-specific statement attributes. All driver-specific attributes are SQLINTEGER values.

SQL_TEXTPTR_LOGGING

The SQL_TEXTPTR_LOGGING attribute exposes logging of operations on columns containing text or image data.

Value Description

SQL_TL_OFF

Logging of operations performed on text, ntext, and image data is disabled.

SQL_TL_ON

Default. Logging of operations performed on text, ntext, and image data is enabled.

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 specifying the location of the command in the batch.

SQL_SOPT_SS_HIDDEN_COLUMNS

The SQL_SOPT_SS_HIDDEN_COLUMNS attribute exposes, in the result set, columns hidden in a SQL Server SELECT FOR BROWSE statement. The driver does not expose these columns by default.

Value Description

SQL_HC_OFF

Default. FOR BROWSE columns are hidden from the result set.

SQL_HC_ON

Exposes FOR BROWSE columns.

SQL_SOPT_SS_NCOUNT_STATUS

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.

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

SQL_SOPT_SS_QUERYNOTIFICATION_OPTIONS

The SQL_SOPT_SS_QUERYNOTIFICATION_OPTIONS attribute specifies the options used for the query notification request. These are specified in a string with name=value syntax as specified below. The user is responsible for creating the service and reading notifications off of the queue.

The syntax of the query notifications options string is:

service=<service-name>[;(local database=<database>|broker instance=<broker instance>)]

For example:

service=mySSBService;local database=mydb

SQL_SOPT_SS_QUERYNOTIFICATION_TIMEOUT

The SQL_SOPT_SS_QUERYNOTIFICATION_TIMEOUT attribute specifies the number of seconds that the query notification is to remain active. The default value is 432000 seconds (5 days).

請參閱

概念

ODBC API Implementation Details

其他資源

SQLSetStmtAttr Function

說明及資訊

取得 SQL Server 2005 協助