FIX: Using a WHERE IN Clause on a Selected UNION May FailLast reviewed: April 10, 1997Article ID: Q162366  | 
	
	
 
 
The information in this article applies to:
 
 SYMPTOMSSELECT statements consisting of a UNION and a WHERE IN clause may fail. For example, the following statement 
    SELECT type, name
      FROM (SELECT * FROM master..sysobjects
                UNION
                SELECT * FROM pubs..sysobjects) as O
      WHERE type IN ('S', 'U')
Produces (in part) the following results:
 type name ---- ------------------------------ U authors P byroyalty C CK__authors__au_id__02DC7882 C CK__authors__zip__04C4C0F4 C CK__jobs__max_lvl__2719D8F8 C CK__jobs__min_lvl__2625B4BF C CK__publisher__pub_i__089551D8 C CK_emp_id WORKAROUNDEmbed SELECT statements into the WHERE IN clause, as shown by the following: 
    SELECT type, name
      FROM (SELECT * FROM master..sysobjects
         UNION
         SELECT * FROM pubs..sysobjects) as O
      WHERE type IN (SELECT 'S' UNION SELECT 'U')
STATUSMicrosoft has confirmed this to be a problem in Microsoft SQL Server version 6.5 Service Pack 1. This problem has been corrected in U.S. Service Pack 2 for Microsoft SQL Server version 6.5. For more information, contact your primary support provider. 
  | 
	
	Additional query words: 
 © 1998 Microsoft Corporation. All rights reserved. Terms of Use.  |