Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

What do the SQL ODBC error codes mean?

What do the SQL ODBC error codes mean?

NOTE: This information can also be found here.

The following list is a compile set of SQL ODBC error codes which may be generated by any incorrect SQL statement or failing function when working with ODBC drives for Excel/Access etc.

The SQLGetDiagRec and SQLGetDiagField functions return SQLSTATE values.
SQLSTATE values are strings that contain five characters. The following table lists SQLSTATE values that a driver can return for SQLGetDiagRec.

SQLState                Error  
01001                   Cursor operation conflict 
01002                   Disconnect error 
01003                   NULL value eliminated in set function 
01004                   String data, right truncated 
01006                   Privilege not revoked 
01007                   Privilege not granted 
01S00                   Invalid connection string attribute 
01S01                   Error in row 
01S02                   Option value changed 
01S06                   Attempt to fetch before the result set returned the first rowset 
01S07                   Fractional truncation 
01S08                   Error saving File DSN 
01S09                   Invalid keyword 
07002                   COUNT field incorrect 
07005                   Prepared statement not a cursor-specification 
07006                   Restricted data type attribute violation 
07009                   Invalid descriptor index 
07S01                   Invalid use of default parameter 
08001                   Client unable to establish connection 
08002                   Connection name in use 
08003                   Connection does not exist 
08004                   Server rejected the connection 
08007                   Connection failure during transaction 
08S01                   Communication link failure 
21S01                   Insert value list does not match column list 
21S02                   Degree of derived table does not match column list 
22001                   String data, right truncated 
22002                   Indicator variable required but not supplied 
22003                   Numeric value out of range 
22007                   Invalid datetime format 
22008                   Datetime field overflow 
22012                   Division by zero or access violation 
42S01                   Base table or view already exists 
42S02                   Base table or view not found 
42S11                   Index already exists 
42S12                    Index not found 
42S21                      Column already exists 
42S22                      Column not found 
44000                      WITH CHECK OPTION violation
HY000 General error
SQLError SQLGetDiagField HY001 Memory allocation error
SQLError SQLGetDiagField HY003 Invalid application buffer type HY004 Invalid SQL data type HY007 Associated statement is not prepared HY008 Operation canceled
SQLBulkOperations SQLColAttribute HY009 Invalid use of null pointer HY010 Function sequence error HY011 Attribute cannot be set now HY012 Invalid transaction operation code HY013 Memory management error
SQLGetDiagField SQLGetDiagRec HY014 Limit on the number of handles exceeded HY015 No cursor name available HY016 Cannot modify an implementation row descriptor HY017 Invalid use of an automatically allocated descriptor handle HY018 Server declined cancel request HY019 Non-character and non-binary data sent in pieces HY020 Attempt to concatenate a null value HY021 Inconsistent descriptor information HY024 Invalid attribute value HY090 Invalid string or buffer length HY091 Invalid descriptor field identifier HY092 Invalid attribute/option identifier HY093 Invalid parameter number HY095 Function type out of range HY096 Invalid information type HY097 Column type out of range HY098 Scope type out of range HY099 Nullable type out of range HY100 Uniqueness option type out of range HY101 Accuracy option type out of range HY103 Invalid retrieval code HY104 Invalid precision or scale value HY105 Invalid parameter type HY106 Fetch type out of range HY107 Row value out of range HY109 Invalid cursor position HY110 Invalid driver completion HY111 Invalid bookmark value HYC00 Optional feature not implemented HYT00 Timeout expired HYT01 Connection timeout expired
SQLDrivers SQLDataSources IM001 Driver does not support this function
SQLAllocHandle SQLDataSources IM002 Data source name not found and no default driver specified IM003 Specified driver could not be loaded IM004 Driver"s SQLAllocHandle on SQL_HANDLE_ENV failed IM005 Driver"s SQLAllocHandle on SQL_HANDLE_DBC failed IM006 Driver"s SQLSetConnectAttr failed IM007 No data source or driver specified; dialog prohibited IM008 Dialog failed IM009 Unable to load translation DLL IM010 Data source name too long IM011 Driver name too long IM012 DRIVER keyword syntax error IM013 Trace file error IM014 Invalid name of File DSN IM015 Corrupt file data source


Source: Microsoft"s MSDN ODBC Error Codes, Appendix A
Secondary source: http://www.roth.net/perl/odbc/SQLState/

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2013-02-15 19:16
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.