This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Download Microsoft Edge
More info about Internet Explorer and Microsoft Edge
This topic discusses SQLSTATE values for ODBC 3.
x
. For more information on ODBC 3.
x
SQLSTATE values, see
SQLSTATE Mappings
.
SQLGetDiagRec
or
SQLGetDiagField
returns SQLSTATE values as defined by Open Group
Data Management: Structured Query Language (SQL), Version 2
(March 1995). SQLSTATE values are strings that contain five characters. The following table lists SQLSTATE values that a driver can return for
SQLGetDiagRec
.
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 value 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 indicates that there is no subclass for that SQLSTATE. The assignment of class and subclass values is defined by SQL-92.
Although successful execution of a function is normally indicated by a return value of SQL_SUCCESS, the SQLSTATE 00000 also indicates success.
01004
String data, right-truncated
SQLBrowseConnect
SQLBulkOperations
SQLColAttribute
SQLDataSources
SQLDescribeCol
SQLDriverConnect
SQLDrivers
SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
SQLFetchScroll
SQLGetConnectAttr
SQLGetCursorName
SQLGetData
SQLGetDescField
SQLGetDescRec
SQLGetEnvAttr
SQLGetInfo
SQLGetStmtAttr
SQLNative
Sql SQLParamData
SQLPutData
SQLSetCursorName
01006
Privilege not revoked
SQLExecDirect
SQLExecute
SQLParamData
01007
Privilege not granted
SQLExecDirect
SQLExecute
SQLParamData
01S00
Invalid connection string attribute
SQLBrowseConnect
SQLDriverConnec
01S01
Error in row
SQLBulkOperations
SQLExtendedFetch
SQLSetPos
01S02
Option value changed
SQLBrowseConnect
SQLConnect
SQLDriverConnect
SQLExecDirect
SQLExecute
SQLParamData
SQLPrepare
SQLSetConnectAttr
SQLSetDescField
SQLSetEnvAttr
SQLSetStmtAttr
01S06
Attempt to fetch before the result set returned the first rowset
SQLExtendedFetch
SQLFetchScroll
01S07
Fractional truncation
SQLBulkOperations
SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
SQLFetchScroll
SQLGetData
SQLParamData
SQLSetPos
01S08
Error saving File DSN
SQLDriverConnect
01S09
Invalid keyword
SQLDriverConnect
07001
Wrong number of parameters
SQLExecDirect
SQLExecute
07002
COUNT field incorrect
SQLExecDirect
SQLExecute
SQLParamData
07005
Prepared statement not a
cursor-specification
SQLColAttribute
SQLDescribeCol
07006
Restricted data type attribute violation
SQLBindCol
SQLBindParameter
SQLBulkOperations
SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
SQLFetchScroll
SQLGetData
SQLParamData
SQLPutData
SQLSetPos
07009
Invalid descriptor index
SQLBindCol
SQLBindParameter
SQLBulkOperations
SQLColAttribute
SQLDescribeCol
SQLDescribeParam
SQLFetch
SQLFetchScroll
SQLGetData
SQLGetDescField
SQLGetDescRec
SQLParamData
SQLSetDescField
SQLSetDescRecSQLSetPos
07S01
Invalid use of default parameter
SQLExecDirect
SQLExecute
SQLParamData
SQLPutData
08001
Client unable to establish connection
SQLBrowseConnect
SQLConnect
SQLDriverConnect
08002
Connection name in use
SQLBrowseConnect
SQLConnect
SQLDriverConnect
SQLSetConnectAttr
08003
Connection not open
SQLAllocHandle
SQLDisconnect
SQLEndTran
SQLGetConnectAttr
SQLGetInfo
SQLNativeSql
SQLSetConnectAttr
08004
Server rejected the connection
SQLBrowseConnect
SQLConnect
SQLDriverConnect
08007
Connection failure during transaction
SQLEndTran
08S01
Communication link failure
SQLBrowseConnect
SQLColumnPrivileges
SQLColumns
SQLConnect
SQLCopyDesc
SQLDescribeCol
SQLDescribeParam
SQLDriverConnect
SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
SQLFetchScroll
SQLForeignKeys
SQLGetConnectAttr
SQLGetData
SQLGetDescField
SQLGetDescRec
SQLGetFunctions
SQLGetInfo
SQLGetTypeInfo
SQLMoreResults
SQLNativeSql
SQLNumParams
SQLNumResultCols
SQLParamData
SQLPrepare
SQLPrimaryKeys
SQLProcedureColumns
SQLProcedures
SQLPutData
SQLSetConnectAttr
SQLSetDescField
SQLSetDescRec
SQLSetEnvAttr
SQLSetStmtAttr
SQLSpecialColumns
SQLStatistics
SQLTablePrivileges
SQLTables
21S01
Insert value list does not match column list
SQLExecDirect
SQLPrepare
21S02
Degree of derived table does not match column list
SQLBulkOperations
SQLExecDirect
SQLExecute
SQLParamData
SQLPrepare
SQLSetPos
22001
String data, right-truncated
SQLBulkOperations
SQLExecDirect
SQLExecute
SQLFetch
SQLFetchScroll
SQLParamData
SQLPutData
SQLSetDescField
SQLSetPos
22002
Indicator variable required but not supplied
SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
SQLFetchScroll
SQLGetData
SQLParamData
22003
Numeric value out of range
SQLBulkOperations
SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
SQLFetchScroll
SQLGetData
SQLGetInfo
SQLParamData
SQLPutData
SQLSetPos
22007
Invalid datetime format
SQLBulkOperations
SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
SQLFetchScroll
SQLGetData
SQLParamData
SQLPutData
SQLSetPos
22008
Datetime field overflow
SQLBulkOperations
SQLExecDirect
QLParamData
SQLPutData
22012
Division by zero
SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
SQLFetchScroll
SQLGetData
SQLPutData
22015
Interval field overflow
SQLBulkOperations
SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
SQLFetchScroll
SQLGetData
SQLParamData
SQLPutData
SQLSetPos
22018
Invalid character value for cast specification
SQLBulkOperations
SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
SQLFetchScroll
SQLGetData
SQLParamData
SQLPutData
SQLSetPos
22019
Invalid escape character
SQLExecDirect
SQLExecute
SQLPrepare
22025
Invalid escape sequence
SQLExecDirect
SQLExecute
SQLPrepare
22026
String data, length mismatch
SQLParamData
23000
Integrity constraint violation
SQLBulkOperations
SQLExecDirect
SQLExecute
SQLParamData
SQLSetPos
24000
Invalid cursor state
SQLBulkOperations
SQLCloseCursor
SQLColumnPrivileges
SQLColumns
SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
SQLFetchScroll
SQLForeignKeys
SQLGetData
SQLGetStmtAttr
SQLGetTypeInfo
SQLNativeSql
SQLPrepare
SQLPrimaryKeys
SQLProcedureColumns
SQLProcedures
SQLSetConnectAttr
SQLSetCursorName
SQLSetPos
SQLSetStmtAttr
SQLSpecialColumns
SQLStatistics
SQLTablePrivileges
SQLTables
25000
Invalid transaction state
SQLDisconnect
25S01
Transaction state
SQLEndTran
25S02
Transaction is still active
SQLEndTran
25S03
Transaction is rolled back
SQLEndTran
28000
Invalid authorization specification
SQLBrowseConnect
SQLConnect
SQLDriverConnect
34000
Invalid cursor name
SQLExecDirect
SQLPrepare
SQLSetCursorName
3C000
Duplicate cursor name
SQLSetCursorName
3D000
Invalid catalog name
SQLExecDirect
SQLPrepare
SQLSetConnectAttr
3F000
Invalid schema name
SQLExecDirect
SQLPrepare
40001
Serialization failure
SQLBulkOperations
SQLColumnPrivileges
SQLColumns
SQLEndTran
SQLExecDirect
SQLExecute
SQLFetch
SQLFetchScroll
SQLForeignKeys
SQLGetTypeInfo
SQLMoreResults
SQLParamData
SQLPrimaryKeys
SQLProcedureColumns
SQLProcedures
SQLSetPos
SQLSpecialColumns
SQLStatistics
SQLTablePrivileges
SQLTables
40002
Integrity constraint violation
SQLEndTran
40003
Statement completion unknown
SQLBulkOperations
SQLColumnPrivileges
SQLColumns
SQLExecDirect
SQLExecute
SQLFetch
SQLFetchScroll
SQLForeignKeys
SQLGetTypeInfo
SQLMoreResults
SQLPrimaryKeys
SQLProcedureColumns
SQLProcedures
SQLParamData
SQLSetPos
SQLSpecialColumns
SQLStatistics
SQLTablePrivileges
SQLTables
42000
Syntax error or access violation
SQLBulkOperations
SQLExecDirect
SQLExecute
SQLParamData
SQLPrepare
SQLSetPos
42S01
Base table or view already exists
SQLExecDirect
SQLPrepare
42S02
Base table or view not found
SQLExecDirect
SQLPrepare
42S11
Index already exists
SQLExecDirect
SQLPrepare
42S12
Index not found
SQLExecDirect
SQLPrepare
42S21
Column already exists
SQLExecDirect
SQLPrepare
42S22
Column not found
SQLExecDirect
SQLPrepare
44000
WITH CHECK OPTION violation
SQLBulkOperations
SQLExecDirect
SQLExecute
SQLParamData
SQLSetPos
HY000
General error
All ODBC functions except:
SQLError
SQLGetDiagField
SQLGetDiagRec
HY001
Memory allocation error
All ODBC functions except:
SQLError
SQLGetDiagField
SQLGetDiagRec
HY003
Invalid application buffer type
SQLBindCol
SQLBindParameter
SQLGetData
HY004
Invalid SQL data type
SQLBindParameter
SQLGetTypeInfo
HY007
Associated statement is not prepared
SQLCopyDesc
SQLGetDescField
SQLGetDescRec
HY008
Operation canceled
All ODBC functions that can be processed asynchronously:
SQLBrowseConnect
SQLBulkOperations
SQLColAttribute
SQLColumnPrivileges
SQLColumns
SQLConnect
SQLDescribeCol
SQLDescribeParam
SQLDisconnect
SQLDriverConnect
SQLEndTran
SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
SQLFetchScroll
SQLForeignKeys
SQLGetData
SQLGetTypeInfo
SQLMoreResults
SQLNumParams
SQLNumResultCols
SQLParamData
SQLPrepare
SQLPrimaryKeys
SQLProcedureColumns
SQLProcedures
SQLPutData
SQLSetConnectAttr
SQLSetPos
SQLSpecialColumns
SQLStatistics
SQLTablePrivileges
SQLTables
HY009
Invalid use of null pointer
SQLAllocHandle
SQLBindParameter
SQLBulkOperations
SQLColumnPrivileges
SQLColumns
SQLExecDirect
SQLForeignKeys
SQLGetCursorName
SQLGetData
SQLGetFunctions
SQLNativeSql
SQLPrepare
SQLPrimaryKeys
SQLProcedureColumns
SQLProcedures
SQLPutData
SQLSetConnectAttr
SQLSetCursorName
SQLSetEnvAttr
SQLSetStmtAttr
SQLSpecialColumns
SQLStatistics
SQLTablePrivileges
SQLTables
HY010
Function sequence error
SQLAllocHandle
SQLBindCol
SQLBindParameter
SQLBulkOperations
SQLCloseCursor
SQLColAttribute
SQLColumnPrivileges
SQLColumns
SQLCopyDesc
SQLDescribeCol
SQLDescribeParam
SQLDisconnect
SQLEndTran
SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
SQLFetchScroll
SQLForeignKeys
SQLFreeHandle
SQLFreeStmt
SQLGetConnectAttr
SQLGetCursorName
SQLGetData
SQLGetDescField
SQLGetDescRec
SQLGetFunctions
SQLGetStmtAttr
SQLGetTypeInfo
SQLMoreResults
SQLNumParams
SQLNumResultCols
SQLParamData
SQLPrepare
SQLPrimaryKeys
SQLProcedureColumns
SQLProcedures
SQLPutData
SQLRowCount
SQLSetConnectAttr
SQLSetCursorName
SQLSetDescField
SQLSetEnvAttr
SQLSetDescRec
SQLSetPos
SQLSetStmtAttr
SQLSpecialColumns
SQLStatistics
SQLTablePrivileges
SQLTables
HY011
Attribute cannot be set now
SQLBulkOperations
SQLParamData
QLSetPos
SQLSetStmtAttr
HY012
Invalid transaction operation code
SQLEndTran
HY013
Memory management error
All ODBC functions except:
SQLGetDiagField
SQLGetDiagRec
HY014
Limit on the number of handles exceeded
SQLAllocHandle
HY015
No cursor name available
SQLGetCursorName
HY016
Cannot modify an implementation row descriptor
SQLCopyDesc
SQLSetDescField
SQLSetDescRec
HY017
Invalid use of an automatically allocated descriptor handle
SQLFreeHandle
SQLSetStmtAttr
HY018
Server declined cancel request
SQLCancel
HY019
Non-character and non-binary data sent in pieces
SQLPutData
HY020
Attempt to concatenate a null value
SQLPutData
HY021
Inconsistent descriptor information
SQLBindParameter
SQLCopyDesc
SQLGetDescField
SQLSetDescField
SQLSetDescRec
HY024
Invalid attribute value
SQLSetConnectAttr
SQLSetEnvAttr
SQLSetStmtAttr
HY090
Invalid string or buffer length
SQLBindCol
SQLBindParameter
SQLBrowseConnect
SQLBulkOperations
SQLColAttribute
SQLColumnPrivileges
SQLColumns
SQLConnect
SQLDataSources
SQLDescribeCol
SQLDriverConnect
SQLDrivers
SQLExecDirect
SQLExecute
SQLFetch
SQLFetchScroll
SQLForeignKeys
SQLGetConnectAttr
SQLGetCursorName
SQLGetData
SQLGetDescField
SQLGetInfo
SQLGetStmtAttr
SQLNativeSql
SQLParamData
SQLPrepare
SQLPrimaryKeys
SQLProcedureColumns
SQLProcedures
SQLPutData
SQLSetConnectAttr
SQLSetCursorName
SQLSetDescField
SQLSetDescRec
SQLSetEnvAttr
SQLSetStmtAttr
SQLSetPos
SQLSpecialColumns
SQLStatistics
SQLTablePrivileges
SQLTables
HY091
Invalid descriptor field identifier
SQLColAttribute
SQLGetDescField
SQLSetDescField
HY092
Invalid attribute/option identifier
SQLAllocHandle
QLBulkOperations
SQLCopyDesc
SQLDriverConnect
SQLEndTran
SQLFreeStmt
SQLGetConnectAttr
SQLGetEnvAttr
QLParamData
SQLSetConnectAttr
SQLSetDescField
SQLSetEnvAttr
SQLSetPos
SQLSetStmtAttr
HY095
Function type out of range
SQLGetFunctions
HY096
Invalid information type
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
Invalid retrieval code
SQLDataSources
SQLDrivers
HY104
Invalid precision or scale value
SQLBindParameter
HY105
Invalid parameter type
SQLBindParameter
SQLExecDirect
SQLExecute
SQLParamData
SQLSetDescField
HY106
Fetch type out of range
SQLExtendedFetch
SQLFetchScroll
HY107
Row value out of range
SQLExtendedFetch
SQLFetch
SQLFetchScroll
SQLSetPos
HY109
Invalid cursor position
SQLExecDirect
SQLExecute
SQLGetData
SQLGetStmtAttr
SQLNativeSql
SQLParamData
SQLSetPos
HY110
Invalid driver completion
SQLDriverConnect
HY111
Invalid bookmark value
SQLExtendedFetch
SQLFetchScroll
HYC00
Optional feature not implemented
SQLBindCol
SQLBindParameter
SQLBulkOperations
SQLColAttribute
SQLColumnPrivileges
SQLColumns
SQLDriverConnect
SQLEndTran
SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLFetch
SQLFetchScroll
SQLForeignKeys
SQLGetConnectAttr
SQLGetData
SQLGetEnvAttr
SQLGetInfo
SQLGetStmtAttr
SQLGetTypeInfo
SQLParamData
SQLPrepare
SQLPrimaryKeys
SQLProcedureColumns
SQLProcedures
SQLSetConnectAttr
SQLSetEnvAttr
SQLSetPos
SQLSetStmtAttr
SQLSpecialColumns
SQLStatistics
SQLTablePrivileges
SQLTables
HYT00
Timeout expired
SQLBrowseConnect
SQLBulkOperations
SQLColumnPrivileges
SQLColumns
SQLConnect
SQLDriverConnect
SQLExecDirect
SQLExecute
SQLExtendedFetch
SQLForeignKeys
SQLGetTypeInfo
SQLParamData
SQLPrepare
SQLPrimaryKeys
SQLProcedureColumns
SQLProcedures
SQLSetPos
SQLSpecialColumns
SQLStatistics
SQLTablePrivileges
SQLTables
HYT01
Connection timeout expired
All ODBC functions except:
SQLDrivers
SQLDataSources
SQLGetEnvAttr
SQLSetEnvAttr
IM001
Driver does not support this function
All ODBC functions except:
SQLAllocHandle
SQLDataSources
SQLDrivers
SQLFreeHandle
SQLGetFunctions
IM002
Data source name not found and no default driver specified
SQLBrowseConnect
SQLConnect
SQLDriverConnect
IM003
Specified driver could not be loaded
SQLBrowseConnect
SQLConnect
SQLDriverConnect
IM004
Driver's
SQLAllocHandle
on SQL_HANDLE_ENV failed
SQLBrowseConnect
SQLConnect
SQLDriverConnect
IM005
Driver's
SQLAllocHandle
on SQL_HANDLE_DBC failed
SQLBrowseConnect
SQLConnect
SQLDriverConnect
IM006
Driver's
SQLSetConnectAttr
failed
SQLBrowseConnect
SQLConnect
SQLDriverConnect
IM007
No data source or driver specified; dialog prohibited
SQLDriverConnect
IM008
Dialog failed
SQLDriverConnect
IM009
Unable to load translation DLL
SQLBrowseConnect
SQLConnect
SQLDriverConnect
SQLSetConnectAttr
IM010
Data source name too long
SQLBrowseConnect
SQLConnect
SQLDriverConnect
IM011
Driver name too long
SQLBrowseConnect
SQLDriverConnect
IM012
DRIVER keyword syntax error
SQLBrowseConnect
SQLDriverConnect
IM013
Trace file error
All ODBC functions.
IM014
Invalid name of File DSN
SQLDriverConnect
IM015
Corrupt file data source
SQLDriverConnect