This article was previously published under Q254806
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 56396 (SQLBUG_70)
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.
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.
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)gocreate view testview asselect col1 from testtableunion select col1 from testtablego