FIX: AV Selecting from VIEW with DISTINCT and Join

Last reviewed: June 27, 1997
Article ID: Q161726
The information in this article applies to:
  • Microsoft SQL Server, version 6.5 Service Pack 1 and 2
BUG #: 16361 (Windows NT: 6.5)

SYMPTOMS

You may receive a handled access violation (AV) when you attempt to select from a view that was created with a DISTINCT clause, and there is a natural JOIN between base tables inside a stored procedure.

When the access violation occurs, you may find the following error message in the SQL Server errorlog:

   spid10   EXCEPTION_ACCESS_VIOLATION raised, attempting to create symptom
   dump kernel   The current contents of process' input buffer are 'exec
   myproc'

WORKAROUND

To work around this problem, place the SELECT statement of the stored procedure inside an EXEC() statement.

For example, if the SELECT against the view was the following:

   select * from view

Change the statement to:

   exec("select * from view")

Otherwise, move the query outside of the stored procedure, or avoid using the DISTINCT keyword in the view definition.

STATUS

Microsoft has confirmed this to be a problem in Microsoft SQL Server version 6.5 Service Pack 1 and 2. This problem has been corrected in U.S. Service Pack 3 for Microsoft SQL Server version 6.5. For more information, contact your primary support provider.


Additional query words: SP1 SP2
Keywords : kbbug6.50.sp1 kbbug6.50.sp2 kbusage SSrvStProc SSrvTran_SQL
Version : 6.5 SP1 SP2
Platform : WINDOWS


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: June 27, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.