Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Only one expression can be specified

Author  Topic 

evanburen
Posting Yak Master

167 Posts

Posted - 2008-05-28 : 12:26:09
Hi

When I try and create this procedure, I get the error below

CREATE PROCEDURE GetUserSearchTypesCount
-- OUTPUT parameter to hold the count.
@UserID int,
@ReturnVal int OUTPUT
AS

SET @ReturnVal = (SELECT TOP 100 percent searchType, COUNT(searchtype) AS SearchCount
FROM ttracksearchresults
WHERE userid=@UserID
GROUP BY searchtype
ORDER BY searchtype)

GO

Error: Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-28 : 12:32:53
You cant assign a variable with a result set. Why are trying to return the entire resultset through the integer variable?Can i ask what your reqmnt is?
Go to Top of Page

evanburen
Posting Yak Master

167 Posts

Posted - 2008-05-28 : 12:38:16
I'm sorry - I posted this in error and have it working now.

Thanks
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-28 : 12:42:30
quote:
Originally posted by evanburen

I'm sorry - I posted this in error and have it working now.

Thanks


No probs. Glad that you sorted it out.
Go to Top of Page
   

- Advertisement -