﻿DECLARE intezmenyCur CURSOR FOR
  SELECT ID FROM T_INTEZMENY i
  WHERE i.TOROLT='F'

DECLARE @intezmenyId int

OPEN intezmenyCur
	FETCH NEXT FROM intezmenyCur INTO @intezmenyId
    WHILE @@FETCH_STATUS=0
    BEGIN
      EXEC dev.uspGenerateTanevAdatokFromExistingTanev
        @intezmenyId = @intezmenyId
       ,@tanevNeveNew = '2019/2020'
       ,@tanevNeveSource = '2018/2019'
       ,@kovetkezoTanev = 1
      FETCH NEXT FROM intezmenyCur INTO @intezmenyId  
    END
CLOSE intezmenyCur
DEALLOCATE intezmenyCur