BUG: AV Using Insert With Correlated Subquery and Check Option

Last reviewed: April 9, 1997
Article ID: Q155181
The information in this article applies to:
  • Microsoft SQL Server, version 6.5

SYMPTOMS

If you insert into a view, which has a correlated subquery preceded by the IN operator and which has been created with the WITH CHECK OPTION, a handled Access Violation error occurs.

WORKAROUND

Do not use the WITH CHECK OPTION or rewrite the correlated subquery in the view as a Join.

STATUS

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

MORE INFORMATION

Consider the following script:

   create table X (xCol1 int not null,
                   xCol2 int not null)
   go

   create table Y (yCol1 int not null)
   go

   create view vX
   as
      select xCol1, xCol2
      from X
      where xCol1 in
         (select yCol1
         from Y
         where yCol1 = xCol1)
      with check option
   go

The following query causes a handled access violation:

   insert vX values (1,1)


Additional query words: AV
Keywords : kbbug6.00 kbbug6.50 kbprg SSrvProg
Version : 6.0 6.5
Platform : NT 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: April 9, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.