declare @sid int,@sname varchar(20),@s1 int,@s2 int,@s3 int,@totalmarks int,@avg float, @grade1 char(1),@grade2 char(1),@grade3 char(1),@percentage float,@actualmarks int begin set @sid=487 set @sname='venkat' set @s1=100 set @s2=85 set @s3=55 set @totalmarks=@s1+@s2+@s3 set @avg=@totalmarks/3 set @percentage=cast(@totalmarks /(@actualmarks*100) as float set @grade1='a' set @grade2='b' set @grade3='c' if(@percentage <55) begin print @grade3 end if(@percentage >=55 or @percentage <=75) begin print @grade2 end if(@percentage >75) begin print @grade1 end print @sid print @sname print @totalmarks print @avg print @percentage end
I AM UNABLE TO PRINT PERCENTAGE
IT IS SHOWING Must declare the scalar variable "@percentage".
AND I NEED TO PRINT GRADE ALSO BASED ON PERCENTAGE
I AM UNABLE TO DO IT PLEASE HELP ME