Showing posts with label 21000microsoftodbc. Show all posts
Showing posts with label 21000microsoftodbc. Show all posts

Monday, March 12, 2012

query engine error 21000

Can anyone tell me why I am getting this error when I try to view my report:

Query Engine Error: '21000:[Microsoft][ODBC SQL Server Driver][SQL Sever] Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <=,>,>= or when the subquery is used as an

Hi there...looks like one of the queries being executed to retrieve data for the report contains an invalid use of a subquery that returns more than 1 record in a scalar context. For example, something like what follows below is illegel if tableb contains more than one row, since the subquery is being used in/expected to act in scalar context (i.e. a single column, single row result set):

select cola from tablea where colb = (select colb from tableb)

If you have the query, maybe we could help some more...

query engine error

Can anyone tell me why I am getting this error when I try to view my report:

Query Engine Error: '21000:[Microsoft][ODBC SQL Server Driver][SQL Sever] Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <=,>,>= or when the subquery is used as anThis is a problem in the SQL-query.

Like the error says, the query has a subquery that returns multiple values (more than one row and column). Subqueries like that can't be in the column list or after the listed operators.

Make sure that the subquery returns only one value.

For example, next query won't work, as the subquery would return many rows (assuming there are many rows in the Suppliers-table):
SELECT ProductID, (SELECT SupplierID FROM Suppliers)
FROM Products

Similarly, the next query will cause the same error:
SELECT ProductID

FROM Products
WHERE SupplierID = (SELECT SupplierID FROM Suppliers)

The solution is to make the subquery to return only one value using WHERE or ORDER BY + TOP 1 statements, for example.|||

Sometime this might fit your need to limit the returned value to only a single on. Sometime you might WANt to return more than one value, then you will either have to use a JOIN, correlated query, or the IN operator like

Similarly, the next query will cause the same error:
SELECT ProductID
FROM Products
WHERE SupplierID IN (SELECT SupplierID FROM Suppliers)

HTH, Jens K. Suessmeyer.


http://www.sqlserver2005.de

|||True. There are lot's of possibilities what he wants to achieve. A correlated subquery could be one alternative, too. Hard to tell without seeing the original query or requirement first :)

Query engine error

Can anyone tell me why I am getting this error when I try to view my report:
Query Engine Error: '21000:[Microsoft][ODBC SQL Server Driver][SQL Sever]
Subquery returned more than 1 value. This is not permitted when the subquery
follows =, !=, <, <=,>,>= or when the subquery is used as an expression.
thanks in advance!
It would help to see your query.
But I expect that it is something like:
Select (select col from tbl where key = topkey) as subcol
from toptable
If the subquery could return more than one value, the query will error out.
Russel Loski, MCSD.Net
"hale" wrote:

> Can anyone tell me why I am getting this error when I try to view my report:
> Query Engine Error: '21000:[Microsoft][ODBC SQL Server Driver][SQL Sever]
> Subquery returned more than 1 value. This is not permitted when the subquery
> follows =, !=, <, <=,>,>= or when the subquery is used as an expression.
>
> --
> thanks in advance!
>