//遍历tmp_check的年份和月份
DECLARE @year as varchar()
DECLARE @month as varchar()
DECLARE cur CURSOR FOR SELECT nf,yf FROM tmp_check;
OPEN cur
fetch next from cur into @year,@month
while(@@fetch_status=)
begin
print(@year)
print(@month)
//在这做其它的事
fetch next from cur into @year,@month
end
close cur
DEALLOCATE cur