create proc P_GradeCourseMC @Grade as int,@Course as varchar(25),@MC as int
--创建一个存储过程@GRADE年级,@Course课程,@MC名次
as
select identity(int,1,1) idd,* into #t from 成绩表 order by @Course Desc
select * from #t where idd=@MC and 年级=@Grade --查询某年级某课程的第几名的记录
drop table #t
Go