Microsoft KB Archive/133407

From BetaArchive Wiki

FIX: IN Condition with More Than 15 Values May Fail

Q133407



The information in this article applies to:


  • Microsoft SQL Server version 6.0





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 : kbprogramming
Issue type : kbbug
Technology : kbSQLServSearch kbAudDeveloper kbSQLServ600


Last Reviewed: March 25, 2000
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.