﻿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))
    EXEC sp_Global_CreateDictionaryItems @IntezmenyId = @intezmenyId, @TanevId = @tanevId

	FETCH NEXT FROM intezmenytanevekCursor INTO @intezmenyId, @tanevId
END  

CLOSE intezmenytanevekCursor  
DEALLOCATE intezmenytanevekCursor

ALTER TABLE T_DICTIONARYITEMBASE NOCHECK CONSTRAINT all  

UPDATE T_DICTIONARYITEMBASE 
SET TOROLT = 'T'
WHERE ID IN (1164, 1181, 1182, 1191, 1194, 1193, 1179, 1167, 1187, 1183, 1171, 1170, 1169, 1175, 1174, 1192, 1184, 1185, 1186, 1188, 1189, 1190, 1163, 1172, 1168)

ALTER TABLE T_DICTIONARYITEMBASE WITH CHECK CHECK CONSTRAINT all


ALTER TABLE T_OKTATASINEVELESIFELADAT NOCHECK CONSTRAINT all  

UPDATE T_OKTATASINEVELESIFELADAT 
SET TOROLT = 'T'
WHERE ID IN (1164, 1181, 1182, 1191, 1194, 1193, 1179, 1167, 1187, 1183, 1171, 1170, 1169, 1175, 1174, 1192, 1184, 1185, 1186, 1188, 1189, 1190, 1163, 1172, 1168)

ALTER TABLE T_OKTATASINEVELESIFELADAT WITH CHECK CHECK CONSTRAINT all


ALTER TABLE T_EVFOLYAMTIPUS_OKTATASINEVELE NOCHECK CONSTRAINT all

DELETE FROM T_EVFOLYAMTIPUS_OKTATASINEVELE
WHERE C_OKTATASINEVELESIFELADATID IN (1164, 1181, 1182, 1191, 1194, 1193, 1179, 1167, 1187, 1183, 1171, 1170, 1169, 1175, 1174, 1192, 1184, 1185, 1186, 1188, 1189, 1190, 1163, 1172, 1168)

ALTER TABLE T_EVFOLYAMTIPUS_OKTATASINEVELE WITH CHECK CHECK CONSTRAINT all


ALTER TABLE T_FELADATELLATASIHELY NOCHECK CONSTRAINT all

UPDATE T_FELADATELLATASIHELY
SET C_OKTATASINEVELESIFELADATTIPUS = 1165
WHERE C_OKTATASINEVELESIFELADATTIPUS = 1164

UPDATE T_FELADATELLATASIHELY
SET C_OKTATASINEVELESIFELADATTIPUS = 6570
WHERE C_OKTATASINEVELESIFELADATTIPUS IN (1181, 1182)

UPDATE T_FELADATELLATASIHELY
SET C_OKTATASINEVELESIFELADATTIPUS = 1156
WHERE C_OKTATASINEVELESIFELADATTIPUS IN (1191, 1194, 1193, 1179, 1167, 1187, 1183, 1171, 1170, 1169, 1175, 1174, 1192, 1184, 1185, 1186, 1188, 1189, 1190, 1163, 1172, 1168)

ALTER TABLE T_FELADATELLATASIHELY WITH CHECK CHECK CONSTRAINT all

