Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

function not returning result

$
0
0

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'.




Viewing all articles
Browse latest Browse all 7129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>