FIX: Using a WHERE IN Clause on a Selected UNION May FailID: Q162366
|
SELECT 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')
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
Embed 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')
Microsoft 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.
Keywords : kbusage SSrvProg kbbug6.50.sp1 kbfix6.50.sp2
Version : 6.5 SP1
Platform : WINDOWS
Issue type :
Last Reviewed: April 8, 1999