FIX: QUERY Statement Causes 512 Error When You Access a View (254806)



The information in this article applies to:

  • Microsoft SQL Server 7.0

This article was previously published under Q254806
BUG #: 56396 (SQLBUG_70)

SYMPTOMS

A QUERY statement may cause a 512 error:
Subquery returned more than 1 value. This is not permitted...
under the following conditions:
  • It queries a view.
  • The view unions a table with itself.
  • The table contains more than one row with a null value in the same column.

STATUS

Microsoft has confirmed this to be a problem in SQL Server 7.0. This problem has been corrected in U.S. Service Pack 2 for Microsoft SQL Server 7.0. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

254561 INF: How to Obtain Service Pack 2 for Microsoft SQL Server 7.0 and Microsoft Data Engine (MSDE) 1.0

For more information, contact your primary support provider.

MORE INFORMATION

The query that follows returns the 512 error:
SELECT * FROM testview WHERE (1 = (SELECT (1)))
				
When used with this table/view definition:
create table testtable (col1 integer, col2 integer)
insert into testtable values (1,null)
insert into testtable values (2,null)
go

create view testview as
select col1 from testtable
union 
select col1 from testtable
go
				

Modification Type:MajorLast Reviewed:3/14/2006
Keywords:kbBug kbfix KB254806