When an error occurs, the SQL Server driver returns the native error number, the SQLSTATE (an ODBC error code), and an error message. The driver gets this information from errors that are detected by the driver and from errors that are returned by SQL Server.