Click here to Skip to main content
15,611,970 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
what does this error means.

i have created one stored procdere with empid as input parameter.

it has some sub queries.
sravani.v 18-Apr-12 2:13am    
can you share your stored procedure?
Prasad_Kulkarni 18-Apr-12 2:17am    
Please post your sql-query

It seems that the subquery returns more than one records. In this case, the result is a set, not a single value, while which is not allowed in your scenario. To avoid this issue, you may have a try to join the result of this subquery, or use TOP 1 to return only one value.

for more refer:[^]
Share this answer
VJ Reddy 18-Apr-12 12:26pm    
TOP 1 is a good idea. 5!
Really simple, your sql has a sub query, something like this

Select * from orders where customer_id = 
  (select customer_id from customer where name ='bob')

Now the query above will only run providing the sub query only returns one record, eg. there is only one Bob.

If there is more then one Bob there will be more then on customer_id return so the ='s operator won't work (you would have to use in or something).

Paste your query so that we can tell you in which other ways you can write it.
Share this answer
Arav Pradeep Gupta 18-Apr-12 3:15am    
Use IN with where clause of out Query like

select * from Order where cust_id in(subquery here).

Use {IN} with where clause of out Query like

select * from Order where cust_id in(subquery here).

Share this answer
ChintanHiremath 7-Jan-15 7:55am    
Can someone help me with the below query, me too getting the same error

SELECT Distinct T1.QID, T1.Title, T1.Vendorid, T1.Severity, T1.Published, Total
FROM Missing_Patch_Table T1,
FROM Missing_Patch_Table
Group by QID
) as T2
where T1.QID = T2.QID
Order by Total desc, Severity, QID;

This works fine when executed in the SQL Server, but when I use this query in VB or C# I get an error
use subquery with in or not in keyword instead of = sign
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900