INF: ODBC SQL Server Driver Server Messages (138539)



The information in this article applies to:

  • Microsoft SQL Server 6.0
  • Microsoft SQL Server 6.5
  • Microsoft Open Database Connectivity 2.5

This article was previously published under Q138539

SUMMARY

This article documents how the Microsoft ODBC SQL Server Driver reports messages returned from SQL Server.

MORE INFORMATION

If the Microsoft ODBC SQL Server Driver receives a message from SQL Server, it will return SQL_ERROR or SQL_SUCCESS_WITH_INFO to the ODBC function call. If the application then calls SQLError, the driver will return information similar to the following:
szSqlState = "37000"
pfNativeError = "170"
szErrorMsg = "[Microsoft][ODBC SQL Server Driver][SQL Server] Line 1:
Incorrect syntax near 'wheer'."

The pfNative code and szErrorMsg string contain the message from SQL Server.

The szErrorMsg string breaks down as follows:
"[Microsoft][ODBC SQL Server Driver]"
This is the standard header for szErrorMsg strings coming
from the Microsoft SQL Server driver, it indicates the
error was detected in the driver itself.

"[SQL Server]"
This indicates that SQL Server is the component which issued
the message.

"Line 1: Incorrect syntax near 'driver'."
This is the actual text of the error message returned from
SQL Server.

The driver returns the error code it received from SQL Server in the pfNative parameter. You can look up the error codes in either Chapter 26, "System Messages" in the SQL Server 6.0 or 6.5 "Administrator's Companion," or in Appendix C, System Messages from the SQL Server 4.2 "Troubleshooting Guide."

Modification Type:MajorLast Reviewed:11/14/2003
Keywords:kbusage KB138539