Microsoft KB Archive/244125

From BetaArchive Wiki

Article ID: 244125

Article Last Modified on 4/7/2006



APPLIES TO

  • Microsoft Data Access Components 2.1 Service Pack 2
  • Microsoft Data Access Components 2.5
  • Microsoft Open Database Connectivity Driver for Access 4.0
  • Microsoft OLE DB Provider for Jet 4.0
  • Microsoft Access 2000 Standard Edition



This article was previously published under Q244125

SYMPTOMS

When you run a SQL query containing more than 22 UNION statements using Microsoft Jet 4.0 the following error appears:

Not a valid alias name.

The same query worked without error when using Microsoft Jet 3.x.

CAUSE

This problem is caused by a bug in the underlying Microsoft Jet 4.0 database engine that is included with the Microsoft Data Access Components (MDAC) versions noted in the earlier. As a result of this bug Microsoft Jet 4.0 is unable to execute queries containing more than 22 UNION statements.

RESOLUTION

To resolve this problem, download and install the latest Jet 4.0 service pack. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

239114 How To: Obtain the Latest Service Pack for the Microsoft Jet 4.0 Database Engine


STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

Note The Microsoft Jet Engine does not ship with MDAC 2.6.

This problem was corrected in Jet 4.0 SP 5.


MORE INFORMATION

Steps to Reproduce the Behavior

  1. Install MDAC 2.1 SP2 on a test computer.
  2. Create an ODBC DSN to the NorthWind.mdb sample database called NorthWind.
  3. Run the following VBA code. NOTE: The VBA project requires a reference to the "Microsoft ActiveX Data Objects 2.1 Library.":

    Sub TestUNIONError()
    Dim conn As New ADODB.Connection
    Dim sql As String
    Dim i As Long
    
        conn.Open "NorthWind"
        For i = 1 To 22
            sql = sql & "select * from shippers UNION "
        Next i
        sql = sql & "select * from shippers"
        conn.Execute sql
        conn.Close
    
    End Sub
                        
  4. Run the application. It results in the following error message:

    Run-time error '-2147467259 (80004005)'.
    [Microsoft][ODBC Microsoft Access Driver] Not a valid alias name.


Keywords: kbbug kbfix kbqfe kbdatabase kbjet kbhotfixserver KB244125