The text of messages returned by the Microsoft® SQL Server™ ODBC driver is placed in the MessageText parameter of SQLGetDiagRec. The source of an error is indicated by the header of the message:
[Microsoft][ODBC Driver Manager]
These errors are raised by the ODBC Driver Manager.
[Microsoft][ODBC Cursor Library]
These errors are raised by the ODBC cursor library.
[Microsoft][ODBC SQL Server Driver]
These errors are raised by the SQL Server ODBC driver. If there are no other nodes with either the name of a Net-Library or SQL Server, then the error was encountered in the driver.
[Microsoft][ODBC SQL Server Driver][Net-Libraryname]
These errors are raised by the SQL Server Net-Library, where Net-Libraryname is the display name of a SQL Server client Net-Library (for example, Named Pipes, Shared Memory, Multiprotocol, TCP/IP Sockets, NWLink IPX/SPX, or Banyan VINES). The remainder of the error message contains the Net-Library function called and the function called in the underlying network API by the TDS function. The pfNative error code returned with these errors is the error code from the underlying network protocol stack.
[Microsoft][ODBC SQL Server Driver][SQL Server]
These errors are raised by SQL Server. The remainder of the error message is the text of the error message from SQL Server. The pfNative code returned with these errors is the error number from SQL Server. For more information about a list of error messages (and their numbers) that can be returned by SQL Server, see the description and error columns of the sysmessages system table in the master database in SQL Server.
To process ODBC errors