ODBC Messages

SQLError returns SQLSTATE values as defined by the X/Open and SQL Access Group SQL CAE specification (1992). 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 SQL-92.

Note

Although successful execution of a function is normally indicated by a return value of SQL_SUCCESS, the SQLSTATE 00000 also indicates success.

SQLSTATE ODBC API (Driver Manager) Error
00000 Success
01000 General warning
01002 Disconnect error
01004 Data truncated
01006 Privilege not revoked
01S00 Invalid connection string attribute
01S01 Error in row
01S02 Option value changed
01S03 No rows updated or deleted
01S04 More than one row updated or deleted
01S05 Cancel treated as FreeStmt/Close
01S06 Attempt to fetch before the result returned the first rowset
07001 Wrong number of parameters
07006 Restricted data type attribute violation
07S01 Invalid use of default paramater
08001 Unable to connect to data source
08002 Connection in use
08003 Connection not open
08004 Data source rejected establishment of 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 truncation
22002 Indicator variable required but not supplied
22003 Numeric value out of range
22005 Error in assignment
22008 Datetime field overflow
22012 Division by zero
22026 String data, length mismatch
23000 Integrity constraint violation
24000 Invalid cursor state
25000 Invalid transaction state
28000 Invalid authorization specification
34000 Invalid cursor name
37000 Syntax error or access violation
3C000 Duplicate cursor name
40001 Serialization failure
42000 Syntax error or access violation
70100 Operation aborted
IM001 Driver does not support this function
IM002 Data source name not found and no default driver specified
IM003 Specified driver could not be loaded
IM004 Driver's SQLAllocEnv failed
IM005 Driver's SQLAllocConnect failed
IM006 Driver's SQLSetConnectOption 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
S0001 Base table or view already exists
S0002 Base table not found
S0011 Index already exists
S0012 Index not found
S0021 Column already exists
S0022 Column not found
S0023 No default for column
S1000 General error
S1001 Memory allocation failure
S1002 Invalid column number
S1003 Program type out of range
S1004 SQL data type out of range
S1008 Operation canceled
S1009 Invalid argument value
S1010 Function sequence error
S1011 Operation invalid at this time
S1012 Invalid transaction operation code specified
S1015 No cursor name available
S1090 Invalid string or buffer length
S1091 Descriptor type out of range
S1092 Option type out of range
S1093 Invalid parameter number
S1094 Invalid scale value
S1095 Function type out of range
S1096 Information type out of range
S1097 Column type out of range
S1098 Scope type out of range
S1099 Nullable type out of range
S1100 Uniqueness option type out of range
S1101 Accuracy option type out of range
S1103 Direction option out of range
S1104 Invalid precision value
S1105 Invalid parameter type
S1106 Fetch type out of range
S1107 Row value out of range
S1108 Concurrency option out of range
S1109 Invalid cursor position
S1110 Invalid driver completion
S1111 Invalid bookmark value
S1C00 Driver not capable
S1DE0 No data at execution values pending
S1T00 Timeout expired

The ODBC SQL Server Driver version 2.5 can return error messages for certain SQLSTATE values, as shown in the following table:

SQLSTATE SQL SERVER DRIVER ERROR
01000 The ODBC catalog stored procedures installed on server %s are version %s; version %02d.%02d.%4.4d or later is required to ensure proper operation. Please contact your system administrator.
01000 Ongoing transaction has been committed
01000 Access to database specified in the odbc.ini file has been denied. Default used.
01000 Language specified in the odbc.ini file is not supported. Default used.
01000 Procedure executed with 'EXEC'. No output parameters returned.
01S02 Packet size change not honored by server, server size used
22008 Invalid date
22008 Invalid time
22008 Invalid timestamp
28000 Invalid authorization specification; Access to selected database has been denied
28000 Invalid authorization specification; Language specified is not supported
IM006 Packet size change not supported by server, default used
IM009 Translation module is not valid
S1000 The stored procedure required to complete this operation could not be found on the server (they were supplied with the ODBC setup disk for the SQL Server driver). Please contact your system administrator.
S1000 Unknown token received from SQL Server
S1000 Operation not allowed while results are pending
S1000 Unable to load communication module. Driver has not been correctly installed.
S1000 Communication module is not valid. Driver has not been correctly installed.
S1000 Warning: Partial insert/update. The insert/update of a text or image column(s) did not succeed.
S1000 Connection is busy with results for another hstmt
S1000 Failure during closing of connection
S1000 Protocol error in TDS stream
S1000 TDS buffer length too large
S1000 Non-default parameter not allowed after default parameter