Error: Only one expression can be specified in the select list

Hi,

Please kindly assis in this error message:
Server: Msg 116, Level 16, State 1, Procedure score_add_verify, Line 6
Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.

create procedure dbo.score_add_verify
@callnumber as int,
@datemonitored as datetime,
@operatorid as int
as
if(select * from operator_analysis
where (callnumber=@callnumber and datemonitored=@datemonitored and operatorid=@operatorid))>0
return 1
else
return 0
Go

EdwardPeterAsked:
Who is Participating?
 
TimCotteeHead of Software ServicesCommented:
Hi EdwardPeter,

Or

if(select Count(*) from operator_analysis
where (callnumber=@callnumber and datemonitored=@datemonitored and operatorid=@operatorid))>0


Tim Cottee
0
 
Renante EnteraSenior PHP DeveloperCommented:
Hi EdwardPeter!

Try this :

@callnumber as int,
@datemonitored as datetime,
@operatorid as int
as
if EXISTS(select * from operator_analysis
where callnumber=@callnumber and datemonitored=@datemonitored and operatorid=@operatorid)
return 1
else
return 0
Go

Hope this helps you.  Just try it.


Goodluck!
eNTRANCE2002 :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.