Functions for setting and retrieving statement attributes

To specify a new value for a statement attribute, call SQLSetStmtAttr(). To obtain the current value of a statement attribute, call SQLGetStmtAttr().

You can set a statement attribute only after you have allocated a statement handle. Statement attributes are one of the following types:
  • Attributes that you can set, but currently only to one specific value
  • Attributes that you can set any time after the statement handle is allocated
  • Attributes that you can set only if no cursor is open on the statement handle

Although you can use the SQLSetConnectAttr() function to set ODBC 2.0 statement attributes, setting statement attributes at the connection level is not recommended.

SQLGetConnectAttr() retrieves only connection attribute values; to retrieve the current value of a statement attribute you must call SQLGetStmtAttr().