﻿IF (@@SERVERNAME LIKE '%KAKH%')
	BEGIN
		SELECT '----- KK specifikus scriptek kezdete -----'
 DROP TABLE IF EXISTS tmpForSwitchDictionaryItemBase CREATE TABLE tmpForSwitchDictionaryItemBase(RegiID int, UjID int, TanevID int, C_NAME nvarchar(500), C_TYPE nvarchar(64))
 ----------------   Óvoda (nemzetiségi)   -----------------
INSERT INTO tmpForSwitchDictionaryItemBase(RegiID, UjID, TanevID, C_NAME, C_TYPE) 
SELECT 7762, 1157, DIB.C_TANEVID, DIB.C_NAME, DIB.C_TYPE 
FROM T_DICTIONARYITEMBASE DIB 
INNER JOIN T_TANEV t ON t.ID = DIB.C_TANEVID AND t.TOROLT = 'F' AND t.C_NEV = '2019/2020'
WHERE DIB.C_TYPE = N'OktatasiNevelesiFeladat' AND DIB.ID = 7762 AND DIB.TOROLT = 'F' 
UPDATE DIB SET 
DIB.C_VISIBLE = 'F' 
FROM T_DICTIONARYITEMBASE DIB 
INNER JOIN T_TANEV t ON t.ID = DIB.C_TANEVID AND t.TOROLT = 'F' AND t.C_NEV = '2019/2020'
WHERE DIB.C_TYPE = N'OktatasiNevelesiFeladat' AND DIB.ID = 7762 
----------------   Általános iskola (nemzetiségi)   -----------------
INSERT INTO tmpForSwitchDictionaryItemBase(RegiID, UjID, TanevID, C_NAME, C_TYPE) 
SELECT 7763, 1158, DIB.C_TANEVID, DIB.C_NAME, DIB.C_TYPE 
FROM T_DICTIONARYITEMBASE DIB 
INNER JOIN T_TANEV t ON t.ID = DIB.C_TANEVID AND t.TOROLT = 'F' AND t.C_NEV = '2019/2020'
WHERE DIB.C_TYPE = N'OktatasiNevelesiFeladat' AND DIB.ID = 7763 AND DIB.TOROLT = 'F' 
UPDATE DIB SET 
DIB.C_VISIBLE = 'F' 
FROM T_DICTIONARYITEMBASE DIB 
INNER JOIN T_TANEV t ON t.ID = DIB.C_TANEVID AND t.TOROLT = 'F' AND t.C_NEV = '2019/2020'
WHERE DIB.C_TYPE = N'OktatasiNevelesiFeladat' AND DIB.ID = 7763 
----------------   Gimnázium (nemzetiségi)   -----------------
INSERT INTO tmpForSwitchDictionaryItemBase(RegiID, UjID, TanevID, C_NAME, C_TYPE) 
SELECT 7764, 1160, DIB.C_TANEVID, DIB.C_NAME, DIB.C_TYPE 
FROM T_DICTIONARYITEMBASE DIB 
INNER JOIN T_TANEV t ON t.ID = DIB.C_TANEVID AND t.TOROLT = 'F' AND t.C_NEV = '2019/2020'
WHERE DIB.C_TYPE = N'OktatasiNevelesiFeladat' AND DIB.ID = 7764 AND DIB.TOROLT = 'F' 
UPDATE DIB SET 
DIB.C_VISIBLE = 'F' 
FROM T_DICTIONARYITEMBASE DIB 
INNER JOIN T_TANEV t ON t.ID = DIB.C_TANEVID AND t.TOROLT = 'F' AND t.C_NEV = '2019/2020'
WHERE DIB.C_TYPE = N'OktatasiNevelesiFeladat' AND DIB.ID = 7764 
----------------   Szakgimnázium (nemzetiségi)   -----------------
INSERT INTO tmpForSwitchDictionaryItemBase(RegiID, UjID, TanevID, C_NAME, C_TYPE) 
SELECT 7765, 5435, DIB.C_TANEVID, DIB.C_NAME, DIB.C_TYPE 
FROM T_DICTIONARYITEMBASE DIB 
INNER JOIN T_TANEV t ON t.ID = DIB.C_TANEVID AND t.TOROLT = 'F' AND t.C_NEV = '2019/2020'
WHERE DIB.C_TYPE = N'OktatasiNevelesiFeladat' AND DIB.ID = 7765 AND DIB.TOROLT = 'F' 
UPDATE DIB SET 
DIB.C_VISIBLE = 'F' 
FROM T_DICTIONARYITEMBASE DIB 
INNER JOIN T_TANEV t ON t.ID = DIB.C_TANEVID AND t.TOROLT = 'F' AND t.C_NEV = '2019/2020'
WHERE DIB.C_TYPE = N'OktatasiNevelesiFeladat' AND DIB.ID = 7765 
----------------   Szakközépiskola (nemzetiségi)   -----------------
INSERT INTO tmpForSwitchDictionaryItemBase(RegiID, UjID, TanevID, C_NAME, C_TYPE) 
SELECT 7766, 1161, DIB.C_TANEVID, DIB.C_NAME, DIB.C_TYPE 
FROM T_DICTIONARYITEMBASE DIB 
INNER JOIN T_TANEV t ON t.ID = DIB.C_TANEVID AND t.TOROLT = 'F' AND t.C_NEV = '2019/2020'
WHERE DIB.C_TYPE = N'OktatasiNevelesiFeladat' AND DIB.ID = 7766 AND DIB.TOROLT = 'F' 
UPDATE DIB SET 
DIB.C_VISIBLE = 'F' 
FROM T_DICTIONARYITEMBASE DIB 
INNER JOIN T_TANEV t ON t.ID = DIB.C_TANEVID AND t.TOROLT = 'F' AND t.C_NEV = '2019/2020'
WHERE DIB.C_TYPE = N'OktatasiNevelesiFeladat' AND DIB.ID = 7766 
----------------   Kollégium (nemzetiségi)   -----------------
INSERT INTO tmpForSwitchDictionaryItemBase(RegiID, UjID, TanevID, C_NAME, C_TYPE) 
SELECT 7767, 1165, DIB.C_TANEVID, DIB.C_NAME, DIB.C_TYPE 
FROM T_DICTIONARYITEMBASE DIB 
INNER JOIN T_TANEV t ON t.ID = DIB.C_TANEVID AND t.TOROLT = 'F' AND t.C_NEV = '2019/2020'
WHERE DIB.C_TYPE = N'OktatasiNevelesiFeladat' AND DIB.ID = 7767 AND DIB.TOROLT = 'F' 
UPDATE DIB SET 
DIB.C_VISIBLE = 'F' 
FROM T_DICTIONARYITEMBASE DIB 
INNER JOIN T_TANEV t ON t.ID = DIB.C_TANEVID AND t.TOROLT = 'F' AND t.C_NEV = '2019/2020'
WHERE DIB.C_TYPE = N'OktatasiNevelesiFeladat' AND DIB.ID = 7767 
		SELECT '----- KK specifikus scriptek vege -----'
	END;