DECLARE tempcursor CURSOR FOR select sal,comm from emp where sal>1000 declare @sal decimal(10,2),@comm int begin open tempcursor; fetch next from tempcursor into @sal,@comm while @@fetch_status=0 begin print '工资为:'+cast(@sal as varchar(10)) print '补助为:'+cast(@comm as varchar(10)) fetch next from tempcursor into @sal,@comm end close tempcursor DEALLOCATE tempcursor End --注意: @@fetch_status是一个游标专用的系统函数,用于表示是否取到值