I have written a function to return certain output with a given input
///////////////////////////////query////////////////////////////
////Function//////////////////
CREATE FUNCTION DescriptionOfGrades (@CourseId AS INT,@Grades AS DECIMAL(3,1)) RETURNS VARCHAR(1) AS
BEGIN
DECLARE @Result VARCHAR(1)
SELECT @Result = (SELECT TOP 1 LtGr.LetterGrade
FROM CourseGrade CoGr
INNER JOIN LetterGrade LtGr
ON CoGr.LetterGradeId=LtGr.LetterGradeId
WHERE CoGr.CourseId=@CourseId AND CoGr.Gradevalue<= @Grades)
RETURN @Result
END
//////Function call//////
SELECT * FROM DesprictionOfGrades(1,95);I am trying to call the function as mentioned in the code.
I have joined the tables CourseGrade and LetterGrades in the function.
Kindly help me resolve
error message:
Invalid object name 'DesprictionOfGrades'.