﻿ DROP TABLE IF EXISTS tmpForSwitchDictionaryItemBase CREATE TABLE tmpForSwitchDictionaryItemBase(RegiID int, UjID int, TanevID int, C_NAME nvarchar(500), C_TYPE nvarchar(64))
 ----------------   Polgári jogviszony - vállalkozási jogviszony   -----------------
INSERT INTO tmpForSwitchDictionaryItemBase(RegiID, UjID, TanevID, C_NAME, C_TYPE) 
SELECT 653, 654, 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'MunkaviszonyTipus' AND DIB.ID = 653 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'MunkaviszonyTipus' AND DIB.ID = 653 
----------------   Szolgálati jogviszony   -----------------
INSERT INTO tmpForSwitchDictionaryItemBase(RegiID, UjID, TanevID, C_NAME, C_TYPE) 
SELECT 7706, 643, 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'MunkaviszonyTipus' AND DIB.ID = 7706 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'MunkaviszonyTipus' AND DIB.ID = 7706 
