BUG: Possible Handled AV w/ Sub-query Using NOT IN and '>'Last reviewed: May 2, 1997Article ID: Q150882 |
The information in this article applies to:
SYMPTOMSIt is possible to experience a handled access violation (AV) when using an IN condition with a sub-query.
CAUSEThere are several conditions that must be present to get the AV:
create table test1 (a char(2) not null) create table test2 (b char(1) not null, c char(1) not null) goinsert test1 values ('1') insert test2 values ('1','1') go create nonclustered index a on test1(a) go select a from test1 where a not in (select c from test2 where b = '1')and a <= '1' go
WORKAROUNDThere are two possible means to workaround this problem. The first is to drop the current index and create either a unique clustered or non- clustered index. Or you can use the convert() function to step-up the column referenced in the sub-query to the same size as the column referenced on the left of the IN condition. An example of this 'step-up' would be to change the query to the following: select a from test1 where a not in (select convert(char(2),c) from test2 where b = '1') and a <= '1'
STATUSMicrosoft has confirmed this to be a problem in Microsoft SQL Server version 6.0. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
|
Additional query words: sql operator select sub-query
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |