ID: Q110769
The information in this article applies to:
Below is a listing of the contents of Appendix A "ODBC Error Codes" from the "Microsoft Open Database Connectivity Software Development Kit (SDK) Programmer's Reference" version 1.0.
SQLError returns SQLSTATE values as defined by the X/Open and SQL Access Group SQL CAE draft specification (1991). SQLSTATE values are strings that contain five characters. The following table lists SQLSTATE values that a driver can return for SQLError.
The character string value returned for an SQLSTATE consists of a two character class value followed by a three character subclass value. A class value of '01' indicates a warning and is accompanied by a return code of SQL_SUCCESS_WITH_INFO. Class values other than '01', except for the class
'IM', indicate an error and are accompanied by a return code of SQL_ERROR.
The class 'IM' is specific to warnings and errors that derive from the
implementation of ODBC itself. The subclass value '000' in any class is for
implementation defined conditions within the given class. The assignment of
class and subclass values is defined by ANSI SQL2.
SQLSTATE Description Can be returned from
---------------------------------------------------------
00000 Success. SQLBrowseConnect
SQLError
01002 Disconnect error. SQLDisconnect
01004 Data truncated. SQLBrowseConnect
SQLColAttributes
SQLDataSources
SQLDescribeCol
SQLDriverConnect
SQLExtendedFetch
SQLFetch
SQLGetCursorName
SQLGetData
SQLGetInfo
SQLNativeSql
01006 Privilege not revoked. SQLExecDirect
SQLExecute
01S00 Invalid connection SQLBrowseConnect
string attribute. SQLDriverConnect
07001 Wrong number of SQLExecDirect
parameters. SQLExecute
07006 Restricted data type SQLExtendedFetch
attribute violation. SQLFetch
SQLGetData
SQLSetParam
08001 Unable to connect to SQLBrowseConnect
data source. SQLConnect
SQLDriverConnect
08002 Connection in use. SQLBrowseConnect
SQLConnect
SQLDriverConnect
08003 Connection not open. SQLAllocStmt
SQLDisconnect
SQLGetConnectOption
SQLGetInfo
SQLNativeSql
SQLSetConnectOption
SQLTransact
08004 Data source rejected SQLBrowseConnect
establishment of SQLConnect
connection. SQLDriverConnect
08007 Connection failure SQLTransact
during transaction.
08S01 Communication link SQLBrowseConnect
failure. SQLColumnPrivileges
SQLColumns
SQLConnect
SQLDriverConnect
SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
SQLForeignKeys
SQLFreeConnect
SQLGetData
SQLGetTypeInfo
SQLParamData
SQLPrepare
SQLPrimaryKeys
SQLProcedureColumns
SQLProcedures
SQLPutData
SQLSetConnectOption
SQLSetStmtOption
SQLSpecialColumns
SQLStatistics
SQLTablePrivileges
SQLTables
21S01 Insert value list does SQLExecDirect
not match column list. SQLPrepare
21S02 Degree of derived table SQLExecDirect
does not match column SQLPrepare
list.
22001 String data right SQLExecDirect
truncation. SQLExecute
SQLPutData
22003 Numeric value out SQLExecDirect
of range. SQLExecute
SQLExtendedFetch
SQLFetch
SQLGetData
SQLGetInfo
SQLPutData
22005 Error in assignment. SQLExecDirect
SQLExecute
SQLPrepare
22008 Datetime field SQLExecDirect
overflow. SQLExecute
SQLPutData
22012 Division by zero. SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
22026 String data, length SQLExecDirect
mismatch. SQLPutData
23000 Integrity constraint SQLExecDirect
violation. SQLExecute
24000 Invalid cursor state. SQLColAttributes
SQLColumnPrivileges
SQLColumns
SQLDescribeCol
SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
SQLForeignKeys
SQLGetData
SQLGetTypeInfo
SQLPrepare
SQLPrimaryKeys
SQLProcedureColumns
SQLProcedures
SQLSetCursorName
SQLSetPos
SQLSetScrollOptions
SQLSpecialColumns
SQLStatistics
SQLTablePrivileges
SQLTables
25000 Invalid transaction SQLDisconnect
state.
28000 Invalid authorization SQLBrowseConnect
specification. SQLConnect
SQLDriverConnect
34000 Invalid cursor name. SQLExecDirect
SQLPrepare
SQLSetCursorName
37000 Syntax error or access SQLExecDirect
violation. SQLNativeSql
SQLPrepare
3C000 Duplicate cursor name. SQLSetCursorName
40001 Serialization failure. SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
42000 Syntax error or access SQLExecDirect
violation. SQLExecute
SQLPrepare
70100 Operation aborted. SQLCancel
IM001 Driver does not All ODBC functions
support this function. except:
SQLAllocConnect
SQLAllocEnv
SQLDataSources
SQLError
SQLFreeConnect
SQLFreeEnv
SQLGetFunctions
IM002 Data source name not SQLBrowseConnect
found and no default SQLConnect
driver specified. SQLDriverConnect
IM003 Driver specified by SQLBrowseConnect
data source name could SQLConnect
not be loaded. SQLDriverConnect
IM004 Driver's SQLAllocEnv SQLBrowseConnect
failed. SQLConnect
SQLDriverConnect
IM005 Driver's SQLBrowseConnect
SQLAllocConnect SQLConnect
failed. SQLDriverConnect
IM006 Driver's SQLSetConnect SQLBrowseConnect
-Option failed. SQLConnect
SQLDriverConnect
IM007 No data source SQLDriverConnect
specified; dialog
prohibited.
IM008 Dialog failed. SQLDriverConnect
IM009 Unable to load SQLBrowseConnect
translation DLL. SQLConnect
SQLDriverConnect
SQLSetConnectOption
S0001 Base table or view SQLExecDirect
already exists. SQLPrepare
S0002 Base table not found. SQLExecDirect
SQLPrepare
S0011 Index already exists. SQLExecDirect
SQLPrepare
S0012 Index not found. SQLExecDirect
SQLPrepare
S0021 Column already exists. SQLExecDirect
SQLExecute
SQLPrepare
S0022 Column not found. SQLExecDirect
SQLPrepare
S1000 General error. All ODBC functions
except:
SQLAllocEnv
SQLError
S1001 Memory allocation All ODBC functions
failure. except:
SQLError
SQLFreeConnect
SQLFreeEnv
S1002 Invalid column number. SQLBindCol
SQLColAttributes
SQLDescribeCol
SQLExtendedFetch
SQLFetch
SQLGetData
S1003 Program type out of SQLBindCol
range. SQLGetData
SQLSetParam
S1004 SQL data type out SQLGetTypeInfo
of range. SQLSetParam
S1008 Operation canceled. All ODBC functions
that can be processed
asynchronously:
SQLColAttributes
SQLColumnPrivileges
SQLColumns
SQLDescribeCol
SQLDescribeParam
SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
SQLForeignKeys
SQLGetData
SQLGetTypeInfo
SQLMoreResults
SQLNumParams
SQLNumResultCols
SQLParamData
SQLPrepare
SQLPrimaryKeys
SQLProcedureColumns
SQLProcedures
SQLPutData
SQLSetPos
SQLSetScrollOptions
SQLSpecialColumns
SQLStatistics
SQLTablePrivileges
SQLTables
S1009 Invalid argument value. SQLAllocConnect
SQLAllocStmt
SQLBindCol
SQLExecDirect
SQLForeignKeys
SQLGetData
SQLGetInfo
SQLNativeSql
SQLPrepare
SQLPutData
SQLSetConnectOption
SQLSetCursorName
SQLSetParam
SQLSetPos
SQLSetStmtOption
S1010 Function sequence SQLBindCol
error. SQLColAttributes
SQLColumnPrivileges
SQLColumns
SQLDescribeCol
SQLDescribeParam
SQLDisconnect
SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
SQLForeignKeys
SQLFreeConnect
SQLFreeEnv
SQLFreeStmt
SQLGetConnectOption
SQLGetCursorName
SQLGetData
SQLGetFunctions
SQLGetInfo
SQLGetStmtOption
SQLGetTypeInfo
SQLMoreResults
SQLNumParams
SQLNumResultCols
SQLParamData
SQLParamOptions
SQLPrepare
SQLPrimaryKeys
SQLProcedureColumns
SQLProcedures
SQLPutData
SQLRowCount
SQLSetConnectOption
SQLSetCursorName
SQLSetParam
SQLSetPos
SQLSetScrollOptions
SQLSetStmtOption
SQLSpecialColumns
SQLStatistics
SQLTablePrivileges
SQLTables
SQLTransact
S1012 Invalid transaction SQLTransact
operation code
specified.
S1015 No cursor name SQLGetCursorName
available.
S1090 Invalid string or SQLBindCol
buffer length. SQLBrowseConnect
SQLColAttributes
SQLColumnPrivileges
SQLColumns
SQLConnect
SQLDataSources
SQLDescribeCol
SQLDriverConnect
SQLExecDirect
SQLExecute
SQLForeignKeys
SQLGetCursorName
SQLGetData
SQLGetInfo
SQLNativeSql
SQLPrepare
SQLPrimaryKeys
SQLProcedureColumns
SQLProcedures
SQLPutData
SQLSetCursorName
SQLSpecialColumns
SQLStatistics
SQLTablePrivileges
SQLTables
S1091 Descriptor type SQLColAttributes
out of range.
S1092 Option type out of SQLFreeStmt
range. SQLGetConnectOption
SQLGetStmtOption
SQLSetConnectOption
SQLSetStmtOption
S1093 Invalid parameter SQLDescribeParam
number. SQLSetParam
S1094 Invalid scale value. SQLSetParam
S1095 Function type out SQLGetFunctions
of range.
S1096 Information type out SQLGetInfo
of range.
S1097 Column type out SQLSpecialColumns
of range.
S1098 Scope type out SQLSpecialColumns
of range.
S1099 Nullable type out SQLSpecialColumns
of range.
S1100 Uniqueness option type SQLStatistics
out of range.
S1101 Accuracy option type SQLStatistics
out of range.
S1102 Table type out of SQLTables
range.
S1103 Direction option SQLDataSources
out of range.
S1106 Fetch type out of SQLExtendedFetch
range.
S1107 Row value out of SQLExtendedFetch
range. SQLParamOptions
SQLSetPos
SQLSetScrollOptions
S1108 Concurrency option SQLSetScrollOptions
out of range.
S1109 Invalid cursor SQLSetPos
position; no keyset
defined.
S1110 Invalid driver SQLDriverConnect
completion.
S1C00 Driver not capable. SQLBindCol
SQLColumnPrivileges
SQLColumns
SQLExtendedFetch
SQLFetch
SQLForeignKeys
SQLGetConnectOption
SQLGetData
SQLGetInfo
SQLGetStmtOption
SQLPrimaryKeys
SQLProcedureColumns
SQLProcedures
SQLSetConnectOption
SQLSetParam
SQLSetPos
SQLSetScrollOptions
SQLSetStmtOption
SQLSpecialColumns
SQLStatistics
SQLTablePrivileges
SQLTables
SQLTransact
S1DE0 No data at execution SQLParamData
values pending. SQLPutData
S1T00 Timeout expired. SQLBrowseConnect
SQLColAttributes
SQLColumnPrivileges
SQLColumnsSQLConnect
SQLDescribeCol
SQLDescribeParam
SQLDriverConnect
SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
SQLForeignKeys
SQLGetData
SQLGetInfo
SQLGetTypeInfo
SQLMoreResults
SQLNumParams
SQLNumResultCols
SQLParamData
SQLPrepare
SQLProcedures
SQLPutData
SQLSetPos
SQLStatistics
SQLTablePrivileges
SQLTables
KBCategory: kbref
KBSubcategory:
Additional reference words: 1.00 ODBC
Last Reviewed: September 6, 1996