Microsoft KB Archive/817850

= FIX: Executing USE and SELECT in Batch Command May Miss One Row When You Use ODBC Driver for SQL Server =

Article ID: 817850

Article Last Modified on 4/25/2007

-

APPLIES TO


 * Microsoft Data Access Components 2.7

-



SYMPTOMS
When you use the ODBC Driver for Microsoft SQL Server, and you execute a USE statement immediately followed by a SELECT statement in a single Batch command, the result set may contain one fewer row than when the statements were executed as separate commands.

You will not notice this behavior when you use Microsoft Data Access Components 2.8.



RESOLUTION
To resolve the problem, use either of the following methods:
 * Execute the USE statement and the SELECT statement as separate commands.
 * Use the OLE DB Provider for Microsoft SQL Server (SQLOLEDB).



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This bug was corrected in MDAC 2.7 Service Pack 1 Refresh.

A supported fix is now available from Microsoft, but it is only intended to correct the problem described in this article. Only apply it to systems that are experiencing this specific problem. This fix may receive additional testing to further ensure product quality. Therefore, if you are not severely affected by this problem, Microsoft recommends that you wait for the next service pack that contains this fix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the fix. For a complete list of Microsoft Product Support Services phone numbers and information about support costs, visit the following Microsoft Web site:

http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS

Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

