﻿DECLARE intezmenytanevekCursor CURSOR LOCAL FOR 
	SELECT C_INTEZMENYID, C_TANEVID
		FROM T_INTEZMENYADATOK

DECLARE @intezmenyId int, @tanevId int

OPEN intezmenytanevekCursor  
FETCH NEXT FROM intezmenytanevekCursor INTO @intezmenyId, @tanevId

WHILE @@FETCH_STATUS = 0 
BEGIN  
	PRINT N'INTÉZMÉNY ID: ' + CAST(@intezmenyId AS NVARCHAR(10)) + N', TANÉV ID: ' + CAST(@tanevId AS NVARCHAR(10))

	INSERT INTO T_RENDSZERBEALLITAS (C_BEALLITASTIPUS, C_ERTEKTIPUS, C_ALAPERTEK, C_ERTEK, SERIAL, CREATOR, C_INTEZMENYID, C_TANEVID) VALUES
	(6852, 1699, '{"Id":"Intezmeny_rovid_nevenek_beallitasa","Value":"true"}', '{"Id":"Intezmeny_rovid_nevenek_beallitasa","Value":"true"}', 0, 1, @intezmenyID, @tanevID)

	FETCH NEXT FROM intezmenytanevekCursor INTO @intezmenyId, @tanevId
END  

CLOSE intezmenytanevekCursor  
DEALLOCATE intezmenytanevekCursor

GO
