BUG: Outer Join VIEW with UNION ALL May Fail with AV

Last reviewed: April 15, 1997
Article ID: Q166632
The information in this article applies to:
  • Microsoft SQL Server, version 6.5
BUG #: 16767

SYMPTOMS

A query may fail with an exception access violation (AV) when you do an OUTER JOIN to a VIEW that was created with the UNION ALL operator. On the client side, the application will receive the following error:

   DB-Library Process Dead - Connection Broken

The following script demonstrates the problem:

   CREATE TABLE dog
   (
      id int
   )
   GO

   CREATE TABLE cat
   (
      id int
   )
   GO

   CREATE TABLE fish
   (
      id int
   )
   GO

   CREATE VIEW pet AS
   SELECT id
   FROM dog
   UNION ALL
   SELECT id
   FROM cat
   GO

   SELECT p.id
   FROM pet p, fish f
   WHERE p.id *= f.id
   GO

WORKAROUND

To work around this problem, you can create a temporary table to hold the result set from the UNION ALL operator. The following script demonstrates the workaround for the above scenario:

   SELECT id INTO #pet
   FROM dog
   UNION ALL
   SELECT id
   FROM cat
   GO

   SELECT p.id
   FROM #pet p, fish f
   WHERE p.id *= f.id
   GO

STATUS

Microsoft has confirmed this to be a problem in Microsoft SQL Server version 6.5. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


Keywords : kbbug6.50 kbusage SSrvTran_SQL
Version : 6.5
Platform : WINDOWS
Issue type : kbbug
Resolution Type : kbpending


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 15, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.