Statement Attributes
Statement attributes are set with SQLSetStmtAttr and their current settings retrieved with SQLGetStmtAttr. There is no requirement that an application set any statement attributes;
all statement attributes have defaults, some of which are driver-specific.
When a statement attribute can be set depends on the attribute itself. The
SQL_ATTR_CONCURRENCY, SQL_ATTR_CURSOR_TYPE, SQL_ATTR_SIMULATE_CURSOR, and
SQL_ATTR_USE_BOOKMARKS statement attributes must be set before the statement is
executed. The SQL_ATTR_ASYNC_ENABLE and SQL_ATTR_NOSCAN statement attributes can be
set at any time, but are not applied until the statement is used again.
SQL_ATTR_MAX_LENGTH, SQL_ATTR_MAX_ROWS, and SQL_ATTR_QUERY_TIMEOUT statement attributes
can be set at any time, but it is driver-specific whether they are applied
before the statement is used again. The remaining statement attributes can be set
at any time.
Note The ability to set statement attributes at the connection level by calling SQLSetConnectAttr has been deprecated in ODBC 3.0. ODBC 3.0 applications should never set
statement attributes at the connection level. ODBC 3.0 drivers need only support
this functionality if they should work with ODBC 2.x applications. For more information, see
None of the statement attributes introduced in ODBC 3.0 (except for
SQL_ATTR_METADATA_ID) can be set at the connection level.
For more information, see the SQLSetStmtAttr function description.