﻿DECLARE @pLekerdezesDatuma datetime = GETDATE()
DECLARE @tanevId nvarchar(100)

DECLARE cur CURSOR LOCAL FOR 
SELECT ia.C_TANEVID
FROM T_INTEZMENY i
  INNER JOIN T_INTEZMENYADATOK ia ON i.ID = ia.C_INTEZMENYID
  INNER JOIN T_TANEV tv ON tv.ID = ia.C_TANEVID AND tv.C_AKTIV = 'T' and tv.TOROLT = 'F'
WHERE i.TOROLT = 'F' AND ia.C_ISSZAKKEPZOJUTTATAS = 'T'
​
OPEN cur 
FETCH NEXT FROM cur INTO @tanevId
WHILE @@FETCH_STATUS = 0 BEGIN
  EXEC uspUpdateTanuloSzakkepzesiJuttatasok
    @pTanevId = @tanevId
    ,@pMaxIgazolatlanokSzama = 6
    ,@pMinOsztondijAtlag = 2.0
    ,@pOsztondijAlap = 100000
    ,@pLekerdezesDatuma = @pLekerdezesDatuma
    ,@pTanuloId = NULL
    ,@pTanuloIdList = NULL
    ,@pFelhasznaloId = 0
    ,@pGeneraltHonap = NULL
    ,@pVisszaallitasDatuma = NULL
    ,@pJuttatasTipusId = 7888

  FETCH NEXT FROM cur INTO @tanevId
END
CLOSE cur
DEALLOCATE cur
