SQLSTATE cross reference

SQLSTATEs are returned by the Db2 ODBC application as a diagnostic tool for encountered errors, indicating the cause for these errors.

Table 1 is a cross-reference of all the SQLSTATEs for each function. This table does not include SQLSTATEs that were remapped between ODBC 2.0 and ODBC 3.0, although deprecated functions continue to return these values.

Important: Db2 ODBC can also return SQLSTATEs generated by the server that are not listed in this table. If the returned SQLSTATE is not listed here, see the documentation for the server for additional SQLSTATE information.

Table 1. SQLSTATE cross reference
SQLSTATE Description Functions
01000 Warning.
  • SQLAllocHandle()
  • SQLCloseCursor()
  • SQLColAttribute()
  • SQLDescribeParam()
  • SQLEndTran()
  • SQLFreeHandle()
  • SQLGetConnectAttr()
  • SQLGetStmtAttr()
  • SQLSetConnectAttr()
  • SQLSetStmtAttr()
01002 Disconnect error.
  • SQLDisconnect()
01004 Data truncated.
  • SQLColAttribute()
  • SQLDataSources()
  • SQLDescribeCol()
  • SQLDriverConnect()
  • SQLExtendedFetch()
  • SQLFetch()
  • SQLGetConnectAttr()
  • SQLGetCursorName()
  • SQLGetData()
  • SQLGetDiagRec()
  • SQLGetInfo()
  • SQLGetStmtAttr()
  • SQLGetSubString()
  • SQLNativeSql()
  • SQLPutData()
  • SQLSetColAttributes()
01504 The UPDATE or DELETE statement does not include a WHERE clause.
  • SQLExecDirect()
  • SQLExecute()
  • SQLPrepare()
01S00 Invalid connection string attribute.
  • SQLDriverConnect()
01S01 Error in row.
  • SQLExtendedFetch()
01S02 Option value changed.
  • SQLDriverConnect()
  • SQLSetConnectAttr()
  • SQLSetStmtAttr()
07001 Wrong number of parameters.
  • SQLExecDirect()
  • SQLExecute()
07002 Too many columns.
  • SQLExtendedFetch()
  • SQLFetch()
07005 The statement did not return a result set.
  • SQLColAttribute()
  • SQLDescribeCol()
07006 Invalid conversion.
  • SQLBindParameter()
  • SQLExecDirect()
  • SQLExecute()
  • SQLExtendedFetch()
  • SQLFetch()
  • SQLGetData()
  • SQLGetLength()
  • SQLGetPosition()
  • SQLGetSubString()
08001 Unable to connect to data source.
  • SQLConnect()
08002 Connection in use.
  • SQLConnect()
08003 Connection is closed.
  • SQLAllocHandle()
  • SQLDisconnect()
  • SQLEndTran()
  • SQLFreeHandle()
  • SQLGetConnectAttr()
  • SQLGetInfo()
  • SQLNativeSql()
  • SQLSetConnectAttr()
  • SQLSetConnection()
08004 The application server rejected establishment of the connection.
  • SQLConnect()
08007 Connection failure during transaction.
  • SQLEndTran()
08S01 Communication link failure.
  • SQLBindCol()
  • SQLBindFileToCol()
  • SQLBindParameter()
  • SQLBindFileToParameter()
  • SQLCancel()
  • SQLColumnPrivileges()
  • SQLColumns()
  • SQLDescribeCol()
  • SQLExecDirect()
  • SQLExecute()
  • SQLExtendedFetch()
  • SQLFetch()
  • SQLForeignKeys()
  • SQLFreeStmt()
  • SQLGetCursorName()
  • SQLGetData()
  • SQLGetFunctions()
  • SQLGetInfo()
  • SQLGetLength()
  • SQLGetPosition()
  • SQLGetSubString()
  • SQLGetTypeInfo()
  • SQLMoreResults()
  • SQLNumParams()
  • SQLNumResultCols()
  • SQLParamData()
  • SQLParamOptions()
  • SQLPrepare()
  • SQLPrimaryKeys()
  • SQLProcedureColumns()
  • SQLProcedures()
  • SQLPutData()
  • SQLRowCount()
  • SQLSetColAttributes()
  • SQLSetCursorName()
  • SQLSetConnectAttr()
  • SQLSetStmtAttr()
  • SQLSpecialColumns()
  • SQLStatistics()
  • SQLTablePrivileges()
  • SQLTables()
0F001 The LOB token variable does not currently represent any value.
  • SQLGetLength()
  • SQLGetPosition()
  • SQLGetSubString()
21S01 Insert value list does not match column list.
  • SQLExecDirect()
  • SQLExecute()
  • SQLPrepare()
21S02 Degrees of derived table does not match column list.
  • SQLExecDirect()
  • SQLExecute()
  • SQLPrepare()
22001 String data right truncation.
  • SQLExecDirect()
  • SQLExecute()
  • SQLPutData()
22002 Invalid output or indicator buffer specified.
  • SQLExtendedFetch()
  • SQLFetch()
  • SQLGetData()
22008 Invalid datetime format or datetime field overflow.
  • SQLExecDirect()
  • SQLExecute()
  • SQLParamData()
  • SQLExtendedFetch()
  • SQLFetch()
  • SQLGetData()
  • SQLPutData()
22011 A substring error occurred.
  • SQLGetSubString()
22012 Division by zero is invalid.
  • SQLExecDirect()
  • SQLExecute()
  • SQLExtendedFetch()
  • SQLFetch()
22018 Error in assignment.
  • SQLExecDirect()
  • SQLExecute()
  • SQLExtendedFetch()
  • SQLFetch()
  • SQLGetData()
  • SQLPutData()
23000 Integrity constraint violation.
  • SQLExecDirect()
  • SQLExecute()
24000 Invalid cursor state.
  • SQLCloseCursor()
  • SQLColumnPrivileges()
  • SQLColumns()
  • SQLExecDirect()
  • SQLExecute()
  • SQLExtendedFetch()
  • SQLFetch()
  • SQLForeignKeys()
  • SQLGetData()
  • SQLGetStmtAttr()
  • SQLGetTypeInfo()
  • SQLPrepare()
  • SQLPrimaryKeys()
  • SQLProcedureColumns()
  • SQLProcedures()
  • SQLSetColAttributes()
  • SQLSetStmtAttr()
  • SQLSpecialColumns()
  • SQLStatistics()
  • SQLTablePrivileges()
  • SQLTables()
24504 The cursor identified in the UPDATE, DELETE, SET, or GET statement is not positioned on a row.
  • SQLExecDirect()
  • SQLExecute()
25000 25501 Invalid transaction state.
  • SQLDisconnect()
34000 Invalid cursor name.
  • SQLExecDirect()
  • SQLExecute()
  • SQLPrepare()
  • SQLSetCursorName()
37xxx Invalid SQL syntax.
  • SQLExecDirect()
  • SQLExecute()
  • SQLNativeSql()
  • SQLPrepare()
40001 Transaction rollback.
  • SQLEndTran()
  • SQLExecDirect()
  • SQLExecute()
  • SQLParamData()
  • SQLPrepare()
42xxx Syntax error or access rule violation
  • SQLExecDirect()
  • SQLExecute()
  • SQLPrepare()
42000 Invalid SQL syntax.
  • SQLNativeSql()
425xx Syntax error or access rule violation
  • SQLExecDirect()
  • SQLExecute()
  • SQLPrepare()
42601 PARMLIST syntax error.
  • SQLProcedureColumns()
42818 The operands of an operator or function are not compatible.
  • SQLGetPosition()
42895 The value of a host variable in the EXECUTE or OPEN statement cannot be used because of its data type
  • SQLExecDirect()
  • SQLExecute()
42S011 Database object already exists.
  • SQLExecDirect()
  • SQLExecute()
  • SQLPrepare()
42S02 Database object does not exist.
  • SQLExecDirect()
  • SQLExecute()
  • SQLPrepare()
42S11 Index already exists.
  • SQLExecDirect()
  • SQLExecute()
  • SQLPrepare()
42S12 Index not found.
  • SQLExecDirect()
  • SQLExecute()
  • SQLPrepare()
42S21 Column already exists.
  • SQLExecDirect()
  • SQLExecute()
  • SQLPrepare()
42S22 Column not found.
  • SQLExecDirect()
  • SQLExecute()
  • SQLPrepare()
44000 Integrity constraint violation.
  • SQLExecDirect()
  • SQLExecute()
54028 The maximum number of concurrent LOB handles has been reached.
  • SQLFetch()
58004 Unexpected system failure.
  • SQLBindCol()
  • SQLBindFileToCol()
  • SQLBindFileToParam()
  • SQLBindParameter()
  • SQLConnect()
  • SQLDriverConnect()
  • SQLDataSources()
  • SQLDescribeCol()
  • SQLDisconnect()
  • SQLExecDirect()
  • SQLExecute()
  • SQLExtendedFetch()
  • SQLFetch()
  • SQLFreeStmt()
  • SQLGetCursorName()
  • SQLGetData()
  • SQLGetFunctions()
  • SQLGetInfo()
  • SQLGetLength()
  • SQLGetPosition()
  • SQLGetSubString()
  • SQLMoreResults()
  • SQLNumResultCols()
  • SQLPrepare()
  • SQLRowCount()
  • SQLSetCursorName()
HY0002 General error.
  • SQLAllocHandle()
  • SQLCloseCursor()
  • SQLColAttribute()
  • SQLDescribeParam()
  • SQLEndTran()
  • SQLFreeHandle()
  • SQLGetConnectAttr()
  • SQLGetStmtAttr()
  • SQLSetColAttributes()
  • SQLSetConnection()
  • SQLSetStmtAttr()
HY001 Memory allocation failure. All functions.
HY002 Invalid column number.
  • SQLBindCol()
  • SQLBindFileToCol()
  • SQLColAttribute()
  • SQLDescribeCol()
  • SQLExtendedFetch()
  • SQLFetch()
  • SQLGetData()
  • SQLSetColAttributes()
HY003 Program type out of range.
  • SQLBindCol()
  • SQLBindParameter()
  • SQLGetData()
  • SQLGetLength()
  • SQLGetSubString()
HY004 Invalid SQL data type.
  • SQLBindParameter()
  • SQLGetTypeInfo()
HY009 Invalid use of a null pointer.
  • SQLAllocHandle()
  • SQLBindFileToCol()
  • SQLBindFileToParam()
  • SQLBindParameter()
  • SQLColumnPrivileges()
  • SQLExecDirect()
  • SQLForeignKeys()
  • SQLGetData()
  • SQLGetFunctions()
  • SQLGetInfo()
  • SQLGetLength()
  • SQLGetPosition()
  • SQLNativeSql()
  • SQLNumParams()
  • SQLNumResultCols()
  • SQLPrepare()
  • SQLPutData()
  • SQLSetCursorName()
  • SQLSetConnectAttr()
  • SQLSetEnvAttr()
  • SQLSetStmtAttr()
HY010 Function sequence error.
  • SQLBindCol()
  • SQLBindFileToCol()
  • SQLBindFileToParam()
  • SQLBindParameter()
  • SQLCloseCursor()
  • SQLColAttribute()
  • SQLColumns()
  • SQLDescribeCol()
  • SQLDescribeParam()
  • SQLDisconnect()
  • SQLEndTran()
  • SQLExecute()
  • SQLExtendedFetch()
  • SQLFetch()
  • SQLForeignKeys()
  • SQLFreeHandle()
  • SQLFreeStmt()
  • SQLGetCursorName()
  • SQLGetData()
  • SQLGetFunctions()
  • SQLGetStmtAttr()
  • SQLGetTypeInfo()
  • SQLMoreResults()
  • SQLNumParams()
  • SQLNumResultCols()
  • SQLParamData()
  • SQLParamOptions()
  • SQLPrepare()
  • SQLPrimaryKeys()
  • SQLProcedureColumns()
  • SQLProcedures()
  • SQLPutData()
  • SQLRowCount()
  • SQLSetColAttributes()
  • SQLSetConnectAttr()
  • SQLSetCursorName()
  • SQLSetStmtAttr()
  • SQLSpecialColumns()
  • SQLStatistics()
  • SQLTablePrivileges()
  • SQLTables()
HY011 Operation invalid at this time.
  • SQLSetConnectAttr()
  • SQLSetEnvAttr()
  • SQLSetStmtAttr()
HY012 Invalid transaction code.
  • SQLEndTran()
HY013 Unexpected memory handling error.
  • SQLAllocHandle()
  • SQLBindCol()
  • SQLBindFileToCol()
  • SQLBindFileToParam()
  • SQLBindParameter()
  • SQLCancel()
  • SQLCloseCursor()
  • SQLConnect()
  • SQLDataSources()
  • SQLDescribeCol()
  • SQLDisconnect()
  • SQLExecDirect()
  • SQLExecute()
  • SQLExtendedFetch()
  • SQLFetch()
  • SQLFreeHandle()
  • SQLGetCursorName()
  • SQLGetData()
  • SQLGetFunctions()
  • SQLGetLength()
  • SQLGetPosition()
  • SQLGetStmtAttr()
  • SQLGetSubString()
  • SQLMoreResults()
  • SQLNumParams()
  • SQLNumResultCols()
  • SQLPrepare()
  • SQLRowCount()
  • SQLSetColAttributes()
  • SQLSetCursorName()
HY014 No more handles.
  • SQLAllocHandle()
  • SQLColumnPrivileges()
  • SQLColumns()
  • SQLExecDirect()
  • SQLExecute()
  • SQLForeignKeys()
  • SQLPrepare()
  • SQLPrimaryKeys()
  • SQLProcedureColumns()
  • SQLProcedures()
  • SQLSpecialColumns()
  • SQLStatistics()
  • SQLTablePrivileges()
  • SQLTables()
HY015 No cursor name available.
  • SQLGetCursorName()
HY019 Numeric value out of range.
  • SQLExecDirect()
  • SQLExecute()
  • SQLExtendedFetch()
  • SQLFetch()
  • SQLGetData()
  • SQLPutData()
HY024 Invalid argument value.
  • SQLConnect()
  • SQLGetSubString()
  • SQLSetConnectAttr()
  • SQLSetEnvAttr()
  • SQLSetStmtAttr()
HY090 Invalid string or buffer length.
  • SQLBindCol()
  • SQLBindFileToCol()
  • SQLBindFileToParam()
  • SQLBindParameter()
  • SQLColAttribute()
  • SQLColumnPrivileges()
  • SQLColumns()
  • SQLConnect()
  • SQLDataSources()
  • SQLDescribeCol()
  • SQLDriverConnect()
  • SQLExecDirect()
  • SQLParamData()
  • SQLForeignKeys()
  • SQLGetConnectAttr()
  • SQLGetCursorName()
  • SQLGetData()
  • SQLGetInfo()
  • SQLGetPosition()
  • SQLGetStmtAttr()
  • SQLGetSubString()
  • SQLNativeSql()
  • SQLPrepare()
  • SQLPrimaryKeys()
  • SQLProcedures()
  • SQLProcedureColumns()
  • SQLPutData()
  • SQLSetColAttributes()
  • SQLSetConnectAttr()
  • SQLSetCursorName()
  • SQLSetEnvAttr()
  • SQLSetStmtAttr()
  • SQLSpecialColumns()
  • SQLStatistics()
  • SQLTables()
  • SQLTablePrivileges()
HY091 Descriptor type out of range.
  • SQLColAttribute()
HY092 Option type out of range.
  • SQLAllocHandle()
  • SQLEndTran()
  • SQLFreeStmt()
  • SQLGetConnectAttr()
  • SQLGetCursorName()
  • SQLGetEnvAttr()
  • SQLGetStmtAttr()
  • SQLSetConnectAttr()
  • SQLSetEnvAttr()
  • SQLSetStmtAttr()
HY093 Invalid parameter number.
  • SQLBindFileToCol()
  • SQLBindFileToParam()
  • SQLBindParameter()
  • SQLDescribeParam()
HY096 Information type out of range.
  • SQLGetInfo()
HY097 Column type out of range.
  • SQLSpecialColumns()
HY098 Scope type out of range.
  • SQLSpecialColumns()
HY099 Nullable type out of range.
  • SQLSpecialColumns()
HY100 Uniqueness option type out of range.
  • SQLStatistics()
HY101 Accuracy option type out of range.
  • SQLStatistics()
HY103 Direction option out of range.
  • SQLDataSources()
HY104 Invalid precision value.
  • SQLBindParameter()
  • SQLSetColAttributes()
HY105 Invalid parameter type.
  • SQLBindParameter()
HY106 Fetch type out of range.
  • SQLExtendedFetch()
HY107 Row value out of range.
  • SQLParamOptions()
HY109 Invalid cursor position.
  • SQLGetStmtAttr()
HY110 Invalid driver completion.
  • SQLDriverConnect()
HY501 Invalid data source name.
  • SQLConnect()
HY506 Error closing a file.
  • SQLFreeHandle()
HYC00 Driver not capable.
  • SQLBindCol()
  • SQLBindFileToCol()
  • SQLBindFileToParam()
  • SQLBindParameter()
  • SQLColAttribute()
  • SQLColumnPrivileges()
  • SQLColumns()
  • SQLDescribeCol()
  • SQLDescribeParam()
  • SQLExtendedFetch()
  • SQLFetch()
  • SQLForeignKeys()
  • SQLGetConnectAttr()
  • SQLGetData()
  • SQLGetInfo()
  • SQLGetLength()
  • SQLGetPosition()
  • SQLGetStmtAttr()
  • SQLGetSubString()
  • SQLPrimaryKeys()
  • SQLProcedureColumns()
  • SQLProcedures()
  • SQLSetConnectAttr()
  • SQLSetEnvAttr()
  • SQLSetStmtAttr()
  • SQLSpecialColumns()
  • SQLStatistics()
  • SQLTables()
  • SQLTablePrivileges()
Notes:
  1. 42Sxx SQLSTATEs replace S00xx SQLSTATEs.
  2. HYxxx SQLSTATEs replace S1xxx SQLSTATEs.