declare @a char(8),@b varchar(10)
declare @c numeric(5,2)
declare @d int
set @d=80
declare xxx cursor
for select 学号,课程名,成绩
from score
open xxx
fetch xxx into @a,@b,@c
while @@fetch_status=0
begin
if(@c>=@d) print @a+replicate(' ',3)+@b+str(@c,5)
fetch from xxx into @a,@b,@c
end
close xxx
deallocate xxx
显示出score表中成绩大于等于@d值的所有记录。