FIX: Conversion Errors Occur in Prepared Statements That Use UNIONs

This article was previously published under Q262462
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 57554 (SQLBUG_70)
When all of the following conditions are met, unexpected error messages may occur:
  • The OLE DB Provider for Microsoft SQL Server (Sqloledb.dll) is used.
  • Two or more parameters of different datatypes are used.
  • The statement is prepared.
  • The statement contains one or more UNION operators
Depending on the exact circumstances the error messages vary widely but may look similar to the following:
SQL error 241: Syntax error converting datetime from character string.
You can use either of the two following workarounds to avoid this problem:
  • Set the Prepared property of the Microsoft ActiveX Data Object (ADO) Command object to false.

  • Use the OLE DB Provider for ODBC Drivers and the ODBC Driver for Microsoft SQL Server.
Microsoft has confirmed this to be a problem in SQL Server 7.0. This problem has been corrected in U.S. Service Pack 3 for Microsoft SQL Server 7.0. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
274799 INF: How to Obtain Service Pack 3 for Microsoft SQL Server 7.0 and Microsoft Data Engine (MSDE) 1.0
For more information, contact your primary support provider.
Conversion FMTONLY sp_prepare sp_execute

Article ID: 262462 - Last Review: 01/10/2015 06:22:09 - Revision: 3.1

Microsoft SQL Server 7.0 Standard Edition, Microsoft OLE DB Provider for SQL Server 7.01

  • kbnosurvey kbarchive kbbug kbfix kbqfe KB262462