使用学校数据库,如果存在名为'stu_info'的对象,则删除存储过程stu_info,并创建如下存储过程:

create proc stu_info @stu_name varchar(20), @stu_grade float as
select student.sno, sname, cname, degree
from student, score, course
where student.sno = score.sno and course.cno = score.cno and sname = @stu_name and degree > @stu_grade

两种方式调用存储过程:

  1. 使用参数执行:
exec stu_info @stu_name='李军', @stu_grade=70
  1. 直接执行:
exec stu_info '李军', 70