﻿UPDATE t
SET t.TOROLT = 'T'
FROM T_INTEZMENY i
  INNER JOIN T_TANEV t ON i.ID = t.C_INTEZMENYID
WHERE t.C_KOVETKEZO = 'T'

DECLARE @IntezmenyID varchar(100)

DECLARE keys_cursor CURSOR FOR
SELECT ID as IntezmenyID from T_INTEZMENY
WHERE C_ISARCHIV = 'F' AND TOROLT = 'F'
ORDER BY IntezmenyID

OPEN keys_cursor

FETCH NEXT FROM keys_cursor
INTO @IntezmenyID

WHILE @@FETCH_STATUS = 0
BEGIN
    EXEC dev.uspGenerateNemKivalaszthatoTanev '2022/2023', @IntezmenyID
    FETCH NEXT FROM keys_cursor
INTO @IntezmenyID

END

CLOSE keys_cursor;
DEALLOCATE keys_cursor;
