I run the following query:
create function passs (@studentid nvarchar(50),@courseid nvarchar(50))
returns char
as
begin
declare @k char
if((select Grades.grade from Grades where Grades.Courses_id=@courseid AND
Students_id=@studentid) >60)
set @k='pass'
else
set @k='no pass'
return @k
end
when i run this :
select Grades.Courses_id,dbo.pass(Grades.Students_id,Grades.Courses_id)
,Grades.Students_id,Grades.grade from Grades
i got this
Msg 512, Level 16, State 1, Line 1 Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.