Article ID: 158618 - Last Review: October 15, 2003 - Revision: 2.0

INF: SQLState 22002 Error When Fetching Results

This article was previously published under Q158618
Expand all | Collapse all

SUMMARY

While fetching results using ODBC SQL Server driver, you may occasionally see the following error message:
SQLState 22002: Indicator variable required but not supplied
This error message is not documented in either the SQL Server driver Help file or the ODBC 2.5 SDK specification document Readme25.txt that ships with the ODBC Desktop Driver Pack 3.0.

MORE INFORMATION

The problem is a documentation bug with the ODBC 2.5 SDK for the SQL State 22002 on SQLFetch. The SQL Server driver follows the ODBC SDK 2.5 specification and returns the error message correctly, as described in the specification.

According to the ODBC 2.5 specification, the driver should return error 22002 on SQLFetch when the data fetched in the particular column is NULL and the SQLBindCol function did not specify a valid pointer for the pcbValue parameter (indicator variable). This is because the driver returns SQL_NULL_DATA in the pcbValue parameter when the data fetched for a particular column is NULL. When the pcbValue is specified as a NULL pointer in your application, the driver raises the correct error message according to the specification.

NOTE: It is generally a good programming practice to specify valid pointers to the pcbValue parameter.

APPLIES TO
  • Microsoft Open Database Connectivity Software Development Kit 2.5
  • Microsoft ODBC Driver for Microsoft SQL Server 2.5
  • Microsoft ODBC Driver for Microsoft SQL Server 2.65
Keywords: 
KB158618
Retired KB ArticleRetired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
 

Article Translations