FIX: IN Condition with More Than 15 Values May Fail

Last reviewed: April 30, 1997
Article ID: Q133407

The information in this article applies to:
  • Microsoft SQL Server, version 6.0
BUG# NT: 10951 (6.00)

SYMPTOMS

If the IN conditional expression of the WHERE clause contains more then 15 constants and is being tested against an INT NULL column, then it will return no rows even if there are qualifying rows.

WORKAROUND

Use an INT NOT NULL column to do these qualifications.

STATUS

Microsoft has confirmed this to be a problem in Microsoft SQL Server version 6.0. This problem was corrected in Service Pack 1 for SQL Server version 6.0. For more information, contact your primary support provider.

MORE INFORMATION

The following commands demonstrate the problem:

   create table t1(c1 int null)
   go
   insert t1 values( 1)
   insert t1 values( 2)
   insert t1 values( 3)
   insert t1 values( 4)
   insert t1 values( 5)
   go
   print "This SELECT fails"
   go
   select c1 from t1 where c1 in (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
   13, 14, 15, 16)
   go
   print "This SELECT works"
   go
   select c1 from t1 where c1 in (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
   13, 14, 15)
   go


Additional query words: sql6 Windows NT
Keywords : kbbug6.00 kbfix6.00.sp1 kbprg SSrvProg SSrvTran_SQL SSrvWinNT
Version : 6.0
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: April 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.