BUG: AV Using Insert With Correlated Subquery and Check Option

ID: Q155181


The information in this article applies to:


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          : kbprg SSrvProg kbbug6.50 kbbug6.00 
Version           : 6.0 6.5
Platform          : NT WINDOWS 
Issue type        : 

Last Reviewed: April 1, 1999