日期:2014-05-18 浏览次数:20703 次
create procedure getCourseName as begin select distinct course.courseName from grade,course where grade.courseID=course.courseID end go ---这里加个GO create procedure stat @courseName nchar(20), @avgGrade float output as begin declare @count int declare @avgGrade float ---这里已经声明过的变量,会报错的 declare @courseName nchar(20) ---这里已经声明过的变量,会报错的 select @count =count(*),@avgGrade=avg(grade)from xsda,grade,course where xsda.no= grade.no and grade.courseID=course.courseID and course.courseName like @courseName select xsda.no as 学号,xsda.name as 姓名,grade.grade as 成绩 from xsda,grade,course where xsda.no=grade.no and grade.courseID=course.courseID and course.courseName like @courseName return @count end go