SQLSTATEs provide detailed information about the cause of a warning or error. For errors that occur in the data source, detected and returned by Microsoft® SQL Server™, the SQL Server ODBC driver maps the returned native error number to the appropriate SQLSTATE. If a native error number does not have an ODBC error code to map to, the SQL Server ODBC driver returns SQLSTATE 42000 (“syntax error or access violation”). For errors that are detected by the driver, the SQL Server ODBC driver generates the appropriate SQLSTATE.
For more information about SQLSTATE values and their meanings, see Appendix A of the ODBC 3.0 Programmers Reference and SDK Guide.
To process ODBC errors