SQLSTATE (ODBC Error Codes)

For errors that occur in the data source that are detected and returned by SQL Server, the SQL Server 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 driver returns SQLSTATE 37000 (Syntax error or access violation). For errors that are detected by the driver, the SQL Server driver generates the appropriate SQLSTATE.