﻿ DROP TABLE IF EXISTS tmpForSwitchDictionaryItemBase CREATE TABLE tmpForSwitchDictionaryItemBase(RegiID int, UjID int, TanevID int, C_NAME nvarchar(500), C_TYPE nvarchar(64))
 ----------------   könyvtárostanár   -----------------
INSERT INTO tmpForSwitchDictionaryItemBase(RegiID, UjID, TanevID, C_NAME, C_TYPE) 
SELECT DIB.ID, 7772, 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'MunkakorTipus' AND DIB.C_NAME = N'könyvtárostanár' AND DIB.TOROLT = 'F' 
UPDATE DIB SET 
DIB.TOROLT = 'T' 
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'MunkakorTipus' AND DIB.C_NAME = N'könyvtárostanár'
----------------   könyvtárostanító   -----------------
INSERT INTO tmpForSwitchDictionaryItemBase(RegiID, UjID, TanevID, C_NAME, C_TYPE) 
SELECT DIB.ID, 7773, 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'MunkakorTipus' AND DIB.C_NAME = N'könyvtárostanító' AND DIB.TOROLT = 'F' 
UPDATE DIB SET 
DIB.TOROLT = 'T' 
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'MunkakorTipus' AND DIB.C_NAME = N'könyvtárostanító'
----------------   utazó gyógypedagógus   -----------------
INSERT INTO tmpForSwitchDictionaryItemBase(RegiID, UjID, TanevID, C_NAME, C_TYPE) 
SELECT DIB.ID, 7774, 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'MunkakorTipus' AND DIB.C_NAME = N'utazó gyógypedagógus' AND DIB.TOROLT = 'F' 
UPDATE DIB SET 
DIB.TOROLT = 'T' 
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'MunkakorTipus' AND DIB.C_NAME = N'utazó gyógypedagógus'
----------------   utazó konduktor   -----------------
INSERT INTO tmpForSwitchDictionaryItemBase(RegiID, UjID, TanevID, C_NAME, C_TYPE) 
SELECT DIB.ID, 7775, 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'MunkakorTipus' AND DIB.C_NAME = N'utazó konduktor' AND DIB.TOROLT = 'F' 
UPDATE DIB SET 
DIB.TOROLT = 'T' 
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'MunkakorTipus' AND DIB.C_NAME = N'utazó konduktor'
