﻿DECLARE intezmenytanevekCursor CURSOR LOCAL FOR
SELECT i.ID, t.ID, t.C_NEV
	FROM T_INTEZMENY i
JOIN T_TANEV t on i.ID = t.C_INTEZMENYID and t.TOROLT = 'F' and t.C_NEV = '2019/2020'
WHERE i.TOROLT = 'F'
DECLARE @intezmenyId int, @tanevId int, @tanevNev nvarchar(20)

OPEN intezmenytanevekCursor
FETCH NEXT FROM intezmenytanevekCursor INTO @intezmenyId, @tanevId, @tanevNev
WHILE @@FETCH_STATUS = 0
BEGIN
	
	INSERT INTO T_ERETTSEGITANTARGYADATOK
		(C_ERETTSEGISZINT,C_ERETTSEGITANTARGY,C_GYAKORLATMAXPONTSZAM,C_IRASBELIMAXPONTSZAM,C_ISGYAKORLAT,C_ISIRASBELI,C_ISSZOBELI,C_OSSZMAXPONTSZAM,C_SZOBELIMAXPONTSZAM
		,C_INTEZMENYID,C_TANEVID,TOROLT,SERIAL,LASTCHANGED,CREATED,MODIFIER,CREATOR,ELOZOTANEVIREKORDID,NNID)
	VALUES
		(6579, 7788, 0, 117, 'F', 'T', 'T', 150, 33, @intezmenyId, @tanevId, 'F', 0, GETDATE(), GETDATE(), NULL, NULL, NULL, NULL)
	
	FETCH NEXT FROM intezmenytanevekCursor INTO @intezmenyId, @tanevId, @tanevNev
END
CLOSE intezmenytanevekCursor
DEALLOCATE intezmenytanevekCursor


update T_ERETTSEGITANTARGYADATOK
set
	C_IRASBELIMAXPONTSZAM = 117
	,C_SZOBELIMAXPONTSZAM = 33
where
	C_ERETTSEGITANTARGY = 6588 /*Magyar nyelv és irodalom*/