﻿--/* Modell verzio: 0     */


--/*DictionaryItemType és Entitás attributuma közötti FK*/

ALTER TABLE [DBO].T_TANULASIEGYSEG 
  ADD CONSTRAINT FK_TanulasiEgyseg_SzakmairanyTipusId_IntezmenyId_TanevId_REF_SzakmairanyTipus 
  FOREIGN KEY (C_SZAKMAIRANYTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_SZAKMAIRANYTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULASIEGYSEG 
  ADD CONSTRAINT FK_TanulasiEgyseg_SzakmaTipusId_IntezmenyId_TanevId_REF_SzakmaTipus 
  FOREIGN KEY (C_SZAKMATIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_SZAKMATIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_UJSZKTRESZSZAKMAOSSZERENDELE 
  ADD CONSTRAINT FK_UjSzktReszszakmaOsszerendeles_AgazatReszSzakmaTipusId_IntezmenyId_TanevId_REF_AgazatReszSzakmaTipus 
  FOREIGN KEY (C_AGAZATRESZSZAKMATIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_AGAZATRESZSZAKMATIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_UJSZKTRESZSZAKMAOSSZERENDELE 
  ADD CONSTRAINT FK_UjSzktReszszakmaOsszerendeles_OktatasiNevelesiFeladatId_IntezmenyId_TanevId_REF_OktatasiNevelesiFeladat 
  FOREIGN KEY (C_OKTATASINEVELESIFELADATID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_OKTATASINEVELESIFELADAT (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_UJSZKTRESZSZAKMAOSSZERENDELE 
  ADD CONSTRAINT FK_UjSzktReszszakmaOsszerendeles_ReszSzakmaTipusId_IntezmenyId_TanevId_REF_ReszSzakmaTipus 
  FOREIGN KEY (C_RESZSZAKMATIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_RESZSZAKMATIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_UJSZKTRESZSZAKMAOSSZERENDELE 
  ADD CONSTRAINT FK_UjSzktReszszakmaOsszerendeles_SzakmaReszSzakmaTipusId_IntezmenyId_TanevId_REF_SzakmaReszSzakmaTipus 
  FOREIGN KEY (C_SZAKMARESZSZAKMATIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_SZAKMARESZSZAKMATIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_REGISZKTOSSZERENDELES 
  ADD CONSTRAINT FK_RegiSzktOsszerendeles_AgazatTipusId_IntezmenyId_TanevId_REF_AgazatTipus 
  FOREIGN KEY (C_AGAZATTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_AGAZATTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_REGISZKTOSSZERENDELES 
  ADD CONSTRAINT FK_RegiSzktOsszerendeles_OktatasiNevelesiFeladatId_IntezmenyId_TanevId_REF_OktatasiNevelesiFeladat 
  FOREIGN KEY (C_OKTATASINEVELESIFELADATID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_OKTATASINEVELESIFELADAT (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_REGISZKTOSSZERENDELES 
  ADD CONSTRAINT FK_RegiSzktOsszerendeles_SzakkepesitesTipusId_IntezmenyId_TanevId_REF_SzakkepesitesTipus 
  FOREIGN KEY (C_SZAKKEPESITESTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_SZAKKEPESITESTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_REGISZKTOSSZERENDELES 
  ADD CONSTRAINT FK_RegiSzktOsszerendeles_SzakmacsoportTipusId_IntezmenyId_TanevId_REF_SzakmacsoportTipus 
  FOREIGN KEY (C_SZAKMACSOPORTTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_SZAKMACSOPORTTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NKTOSSZERENDELES 
  ADD CONSTRAINT FK_NktOsszerendeles_OktatasiNevelesiFeladatId_IntezmenyId_TanevId_REF_OktatasiNevelesiFeladat 
  FOREIGN KEY (C_OKTATASINEVELESIFELADATID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_OKTATASINEVELESIFELADAT (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NKTOSSZERENDELES 
  ADD CONSTRAINT FK_NktOsszerendeles_SzakiranyNktTipusId_IntezmenyId_TanevId_REF_SzakiranyNktTipus 
  FOREIGN KEY (C_SZAKIRANYNKTTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_SZAKIRANYNKTTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NKTOSSZERENDELES 
  ADD CONSTRAINT FK_NktOsszerendeles_SzakkepesitesNktTipusId_IntezmenyId_TanevId_REF_SzakkepesitesNktTipus 
  FOREIGN KEY (C_SZAKKEPESITESNKTTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_SZAKKEPESITESNKTTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NKTOSSZERENDELES 
  ADD CONSTRAINT FK_NktOsszerendeles_TanulmanyiTeruletNktTipusId_IntezmenyId_TanevId_REF_TanulmanyiTeruletNktTipus 
  FOREIGN KEY (C_TANULMANYITERULETNKTTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_TANULMANYITERULETNKTTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_UJSZKTSZAKMAJEGYZEKOSSZEREND 
  ADD CONSTRAINT FK_UjSzktSzakmajegyzekOsszerendeles_AgazatUjSzktTipusId_IntezmenyId_TanevId_REF_AgazatUjSzktTipus 
  FOREIGN KEY (C_AGAZATUJSZKTTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_AGAZATUJSZKTTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_UJSZKTSZAKMAJEGYZEKOSSZEREND 
  ADD CONSTRAINT FK_UjSzktSzakmajegyzekOsszerendeles_OktatasiNevelesiFeladatId_IntezmenyId_TanevId_REF_OktatasiNevelesiFeladat 
  FOREIGN KEY (C_OKTATASINEVELESIFELADATID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_OKTATASINEVELESIFELADAT (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_UJSZKTSZAKMAJEGYZEKOSSZEREND 
  ADD CONSTRAINT FK_UjSzktSzakmajegyzekOsszerendeles_SzakmairanyTipusId_IntezmenyId_TanevId_REF_SzakmairanyTipus 
  FOREIGN KEY (C_SZAKMAIRANYTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_SZAKMAIRANYTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_UJSZKTSZAKMAJEGYZEKOSSZEREND 
  ADD CONSTRAINT FK_UjSzktSzakmajegyzekOsszerendeles_SzakmaTipusId_IntezmenyId_TanevId_REF_SzakmaTipus 
  FOREIGN KEY (C_SZAKMATIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_SZAKMATIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_SZERVEZET 
  ADD CONSTRAINT FK_Szervezet_DualishelyszintipusId_IntezmenyId_TanevId_REF_DualisHelyszinTipus 
  FOREIGN KEY (C_DUALISHELYSZINTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_DUALISHELYSZINTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ERTEKELESTANTARGYINYELV 
  ADD CONSTRAINT FK_ErtekelesTantargyiNyelv_NyelvId_IntezmenyId_TanevId_REF_Anyanyelv 
  FOREIGN KEY (C_NYELVID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ANYANYELV (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ERTEKELESMAGSZOR 
  ADD CONSTRAINT FK_ErtekelesMagSzor_ErtekelesTipusId_IntezmenyId_TanevId_REF_ErtekelesTipus 
  FOREIGN KEY (C_ERTEKELESTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ERTEKELESTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ERTEKELESMAGSZOR 
  ADD CONSTRAINT FK_ErtekelesMagSzor_MagatartasErtekelesTipusId_IntezmenyId_TanevId_REF_MagatartasErtekelesTipus 
  FOREIGN KEY (C_MAGATARTASERTEKELESTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_MAGATARTASERTEKELESTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ERTEKELESMAGSZOR 
  ADD CONSTRAINT FK_ErtekelesMagSzor_MagatartasOsztalyzatTipusId_IntezmenyId_TanevId_REF_OsztalyzatTipus 
  FOREIGN KEY (C_MAGATARTASOSZTALYZATTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_OSZTALYZATTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ERTEKELESMAGSZOR 
  ADD CONSTRAINT FK_ErtekelesMagSzor_RogziteskoriEvfolyamTipusId_IntezmenyId_TanevId_REF_EvfolyamTipus 
  FOREIGN KEY (C_ROGZITESKORIEVFOLYAMTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_EVFOLYAMTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ERTEKELESMAGSZOR 
  ADD CONSTRAINT FK_ErtekelesMagSzor_SzorgalomErtekelesTipusId_IntezmenyId_TanevId_REF_SzorgalomErtekelesTipus 
  FOREIGN KEY (C_SZORGALOMERTEKELESTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_SZORGALOMERTEKELESTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ERTEKELESMAGSZOR 
  ADD CONSTRAINT FK_ErtekelesMagSzor_SzorgalomOsztalyzatTipusId_IntezmenyId_TanevId_REF_OsztalyzatTipus 
  FOREIGN KEY (C_SZORGALOMOSZTALYZATTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_OSZTALYZATTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ERTEKELESMAGSZORNYELV 
  ADD CONSTRAINT FK_ErtekelesMagSzorNyelv_NyelvId_IntezmenyId_TanevId_REF_Anyanyelv 
  FOREIGN KEY (C_NYELVID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ANYANYELV (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ERTEKELESTANTARGYI 
  ADD CONSTRAINT FK_ErtekelesTantargyi_ErtekelesModId_IntezmenyId_TanevId_REF_ErtekelesMod 
  FOREIGN KEY (C_ERTEKELESMODID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ERTEKELESMOD (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ERTEKELESTANTARGYI 
  ADD CONSTRAINT FK_ErtekelesTantargyi_ErtekelesTipusId_IntezmenyId_TanevId_REF_ErtekelesTipus 
  FOREIGN KEY (C_ERTEKELESTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ERTEKELESTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ERTEKELESTANTARGYI 
  ADD CONSTRAINT FK_ErtekelesTantargyi_OsztalyzatTipusId_IntezmenyId_TanevId_REF_OsztalyzatTipus 
  FOREIGN KEY (C_OSZTALYZATTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_OSZTALYZATTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ERTEKELESTANTARGYI 
  ADD CONSTRAINT FK_ErtekelesTantargyi_RogziteskoriEvfolyamTipusId_IntezmenyId_TanevId_REF_EvfolyamTipus 
  FOREIGN KEY (C_ROGZITESKORIEVFOLYAMTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_EVFOLYAMTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TBJOGVISZONY 
  ADD CONSTRAINT FK_TbJogviszony_JogvKeletkezeseJogcimTipusId_IntezmenyId_TanevId_REF_JogvKeletkezeseJogcimTipus 
  FOREIGN KEY (C_JOGVKELETKEZESEJOGCIMTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_JOGVKELETKEZESEJOGCIMTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TBJOGVISZONY 
  ADD CONSTRAINT FK_TbJogviszony_JogvMegszuneseJogcimTipusId_IntezmenyId_TanevId_REF_JogvMegszuneseJogcimTipus 
  FOREIGN KEY (C_JOGVMEGSZUNESEJOGCIMTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_JOGVMEGSZUNESEJOGCIMTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TBJOGVISZONY 
  ADD CONSTRAINT FK_TbJogviszony_TbJogviszonyTipusId_IntezmenyId_TanevId_REF_TbJogviszonyTipus 
  FOREIGN KEY (C_TBJOGVISZONYTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_TBJOGVISZONYTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_AGAZATRESZSZAKMATIPUS 
  ADD CONSTRAINT FK_AgazatReszSzakmaTipus_OktatasiNevelesiFeladatId_AlintezmenyId_AltanevId_REF_OktatasiNevelesiFeladat 
  FOREIGN KEY (C_OKTATASINEVELESIFELADATID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_OKTATASINEVELESIFELADAT (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ESZKOZIGENYLES 
  ADD CONSTRAINT FK_EszkozIgenyles_EszkozIgenylesStatuszId_IntezmenyId_TanevId_REF_EszkozIgenylesStatusz 
  FOREIGN KEY (C_ESZKOZIGENYLESSTATUSZID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ESZKOZIGENYLESSTATUSZ (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANITASIORADIGTAMESZKOZ 
  ADD CONSTRAINT FK_TanitasiOraDigTamEszkoz_DigTamEszkozTipusId_IntezmenyId_TanevId_REF_DigTamEszkozTipus 
  FOREIGN KEY (C_DIGTAMESZKOZTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_DIGTAMESZKOZTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ZARADEKNYELV 
  ADD CONSTRAINT FK_ZaradekNyelv_NyelvId_IntezmenyId_TanevId_REF_Anyanyelv 
  FOREIGN KEY (C_NYELVID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ANYANYELV (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ORAFILE 
  ADD CONSTRAINT FK_OraFile_OraFileTipusId_IntezmenyId_TanevId_REF_OraFileTipus 
  FOREIGN KEY (C_ORAFILETIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ORAFILETIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_SZIRSTATFILE 
  ADD CONSTRAINT FK_SzirStatFile_SzirStatTipusId_IntezmenyId_TanevId_REF_SzirStatTipus 
  FOREIGN KEY (C_SZIRSTATTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_SZIRSTATTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_EGYHAZTARTASBANELOK 
  ADD CONSTRAINT FK_EgyHaztartasbanElok_RokonsagiFokId_IntezmenyId_TanevId_REF_RokonsagiFok 
  FOREIGN KEY (C_ROKONSAGIFOKID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ROKONSAGIFOK (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_SZAKMATIPUS 
  ADD CONSTRAINT FK_SzakmaTipus_AgazatId_AlintezmenyId_AltanevId_REF_AgazatTipus 
  FOREIGN KEY (C_AGAZATID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_AGAZATTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOSNI 
  ADD CONSTRAINT FK_TanuloSni_FogyatekossagTipusId_IntezmenyId_TanevId_REF_FogyatekossagTipus 
  FOREIGN KEY (C_FOGYATEKOSSAGTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_FOGYATEKOSSAGTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOTANTARGYATLAG 
  ADD CONSTRAINT FK_TanuloTantargyAtlag_OktatasNevelesiFeladatId_IntezmenyId_TanevId_REF_OktatasiNevelesiFeladat 
  FOREIGN KEY (C_OKTATASNEVELESIFELADATID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_OKTATASINEVELESIFELADAT (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_JUTTATAS 
  ADD CONSTRAINT FK_Juttatas_JuttatasTipusId_IntezmenyId_TanevId_REF_JuttatasTipus 
  FOREIGN KEY (C_JUTTATASTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_JUTTATASTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOKOZOSSEGISZOLGALATNYEL 
  ADD CONSTRAINT FK_TanuloKozossegiSzolgalatNyelv_NyelvId_IntezmenyId_TanevId_REF_Anyanyelv 
  FOREIGN KEY (C_NYELVID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ANYANYELV (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOERTEKELESNYELV 
  ADD CONSTRAINT FK_TanuloErtekelesNyelv_NyelvId_IntezmenyId_TanevId_REF_Anyanyelv 
  FOREIGN KEY (C_NYELVID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ANYANYELV (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ERTEKELESMONDATBANKNYELV 
  ADD CONSTRAINT FK_ErtekelesMondatbankNyelv_NyelvId_IntezmenyId_TanevId_REF_Anyanyelv 
  FOREIGN KEY (C_NYELVID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ANYANYELV (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_DICTIONARYITEMBASENYELV 
  ADD CONSTRAINT FK_DictionaryItemBaseNyelv_NyelvId_IntezmenyId_TanevId_REF_Anyanyelv 
  FOREIGN KEY (C_NYELVID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ANYANYELV (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOESEMENYNYELV 
  ADD CONSTRAINT FK_TanuloEsemenyNyelv_NyelvId_IntezmenyId_TanevId_REF_Anyanyelv 
  FOREIGN KEY (C_NYELVID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ANYANYELV (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANTARGYNYELV 
  ADD CONSTRAINT FK_TantargyNyelv_NyelvId_IntezmenyId_TanevId_REF_Anyanyelv 
  FOREIGN KEY (C_NYELVID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ANYANYELV (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_BESZERZESIIGENY 
  ADD CONSTRAINT FK_BeszerzesiIgeny_StatuszId_IntezmenyId_TanevId_REF_BeszerzesiIgenySatusz 
  FOREIGN KEY (C_STATUSZID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_BESZERZESIIGENYSATUSZ (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_BESZERZESISZALLITOTORZS 
  ADD CONSTRAINT FK_BeszerzesiSzallitotorzs_KozteruletJellegId_IntezmenyId_TanevId_REF_KozteruletJelleg 
  FOREIGN KEY (C_KOZTERULETJELLEGID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_KOZTERULETJELLEG (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_BESZERZESIANYAG 
  ADD CONSTRAINT FK_BeszerzesiAnyag_MennyisegiEgysegId_IntezmenyId_TanevId_REF_MennyisegiEgyseg 
  FOREIGN KEY (C_MENNYISEGIEGYSEGID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_MENNYISEGIEGYSEG (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_BESZERZESIANYAGTORZS 
  ADD CONSTRAINT FK_BeszerzesiAnyagtorzs_MennyisegiEgysegId_IntezmenyId_TanevId_REF_MennyisegiEgyseg 
  FOREIGN KEY (C_MENNYISEGIEGYSEGID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_MENNYISEGIEGYSEG (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_BESZERZESISZALLITO 
  ADD CONSTRAINT FK_BeszerzesiSzallito_KozteruletJellegId_IntezmenyId_TanevId_REF_KozteruletJelleg 
  FOREIGN KEY (C_KOZTERULETJELLEGID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_KOZTERULETJELLEG (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_FOGLALKOZASAMITANULO 
  ADD CONSTRAINT FK_FoglalkozasAmiTanulo_AMIFotargyId_IntezmenyId_TanevId_REF_AMIFotargy 
  FOREIGN KEY (C_AMIFOTARGYID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_AMIFOTARGY (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_FOGLALKOZASAMITANULO 
  ADD CONSTRAINT FK_FoglalkozasAmiTanulo_AmiTagozatId_IntezmenyId_TanevId_REF_AMITagozat 
  FOREIGN KEY (C_AMITAGOZATID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_AMITAGOZAT (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_FOGLALKOZASAMITANULO 
  ADD CONSTRAINT FK_FoglalkozasAmiTanulo_AMITantargyKotelezosegId_IntezmenyId_TanevId_REF_AMITantargyKotelezoseg 
  FOREIGN KEY (C_AMITANTARGYKOTELEZOSEGID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_AMITANTARGYKOTELEZOSEG (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_FOGLALKOZASAMITANULO 
  ADD CONSTRAINT FK_FoglalkozasAmiTanulo_EvfolyamTipusId_IntezmenyId_TanevId_REF_EvfolyamTipus 
  FOREIGN KEY (C_EVFOLYAMTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_EVFOLYAMTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_SZAMONKERESELOREJELZES 
  ADD CONSTRAINT FK_SzamonkeresElorejelzes_SzamonkeresModId_IntezmenyId_TanevId_REF_ErtekelesMod 
  FOREIGN KEY (C_SZAMONKERESMODID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ERTEKELESMOD (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_SAPTAVOLLET 
  ADD CONSTRAINT FK_SAPTavollet_TavolletTipusId_IntezmenyId_TanevId_REF_TavolletTipus 
  FOREIGN KEY (C_TAVOLLETTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_TAVOLLETTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TAVOLLETJELENTO 
  ADD CONSTRAINT FK_TavolletJelento_StatuszId_IntezmenyId_TanevId_REF_TavolletStatusz 
  FOREIGN KEY (C_STATUSZID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_TAVOLLETSTATUSZ (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TAVOLLETJELENTO 
  ADD CONSTRAINT FK_TavolletJelento_TavolletTipusId_IntezmenyId_TanevId_REF_TavolletTipus 
  FOREIGN KEY (C_TAVOLLETTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_TAVOLLETTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TEREMELERHETOSEG 
  ADD CONSTRAINT FK_TeremElerhetoseg_HetNapja_IntezmenyId_TanevId_REF_HetNapjaTipus 
  FOREIGN KEY (C_HETNAPJA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_HETNAPJATIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOTANUGYIADATOK 
  ADD CONSTRAINT FK_TanuloTanugyiAdatok_MagantanulosaganakOkaId_IntezmenyId_TanevId_REF_MagantanulosagOka 
  FOREIGN KEY (C_MAGANTANULOSAGANAKOKAID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_MAGANTANULOSAGOKA (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOTANUGYIADATOK 
  ADD CONSTRAINT FK_TanuloTanugyiAdatok_TanuloEvfolyamTipusId_IntezmenyId_TanevId_REF_EvfolyamTipus 
  FOREIGN KEY (C_TANULOEVFOLYAMTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_EVFOLYAMTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOTANUGYIADATOK 
  ADD CONSTRAINT FK_TanuloTanugyiAdatok_TanterviJellemzoId_IntezmenyId_TanevId_REF_TanterviJellemzoTipus 
  FOREIGN KEY (C_TANTERVIJELLEMZOID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_TANTERVIJELLEMZOTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOTANUGYIADATOK 
  ADD CONSTRAINT FK_TanuloTanugyiAdatok_AgazatUjSzktTipusId_IntezmenyId_TanevId_REF_AgazatUjSzktTipus 
  FOREIGN KEY (C_AGAZATUJSZKTTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_AGAZATUJSZKTTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOTANUGYIADATOK 
  ADD CONSTRAINT FK_TanuloTanugyiAdatok_SzakmairanyTipusId_IntezmenyId_TanevId_REF_SzakmairanyTipus 
  FOREIGN KEY (C_SZAKMAIRANYTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_SZAKMAIRANYTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOTANUGYIADATOK 
  ADD CONSTRAINT FK_TanuloTanugyiAdatok_SzakmaTipusId_IntezmenyId_TanevId_REF_SzakmaTipus 
  FOREIGN KEY (C_SZAKMATIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_SZAKMATIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOTANUGYIADATOK 
  ADD CONSTRAINT FK_TanuloTanugyiAdatok_SzakiranyNktTipusId_IntezmenyId_TanevId_REF_SzakiranyNktTipus 
  FOREIGN KEY (C_SZAKIRANYNKTTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_SZAKIRANYNKTTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOTANUGYIADATOK 
  ADD CONSTRAINT FK_TanuloTanugyiAdatok_SzakkepesitesNktTipusId_IntezmenyId_TanevId_REF_SzakkepesitesNktTipus 
  FOREIGN KEY (C_SZAKKEPESITESNKTTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_SZAKKEPESITESNKTTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOTANUGYIADATOK 
  ADD CONSTRAINT FK_TanuloTanugyiAdatok_TanulmanyiTeruletNktTipusId_IntezmenyId_TanevId_REF_TanulmanyiTeruletNktTipus 
  FOREIGN KEY (C_TANULMANYITERULETNKTTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_TANULMANYITERULETNKTTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOTANUGYIADATOK 
  ADD CONSTRAINT FK_TanuloTanugyiAdatok_AgazatId_IntezmenyId_TanevId_REF_AgazatTipus 
  FOREIGN KEY (C_AGAZATID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_AGAZATTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOTANUGYIADATOK 
  ADD CONSTRAINT FK_TanuloTanugyiAdatok_ReszszakkepesitesId_IntezmenyId_TanevId_REF_ReszszakkepesitesTipus 
  FOREIGN KEY (C_RESZSZAKKEPESITESID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_RESZSZAKKEPESITESTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOTANUGYIADATOK 
  ADD CONSTRAINT FK_TanuloTanugyiAdatok_SzakkepesitesId_IntezmenyId_TanevId_REF_SzakkepesitesTipus 
  FOREIGN KEY (C_SZAKKEPESITESID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_SZAKKEPESITESTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOTANUGYIADATOK 
  ADD CONSTRAINT FK_TanuloTanugyiAdatok_SzakmacsoportId_IntezmenyId_TanevId_REF_SzakmacsoportTipus 
  FOREIGN KEY (C_SZAKMACSOPORTID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_SZAKMACSOPORTTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOTANUGYIADATOK 
  ADD CONSTRAINT FK_TanuloTanugyiAdatok_MufajTipusId_IntezmenyId_TanevId_REF_MufajTipus 
  FOREIGN KEY (C_MUFAJTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_MUFAJTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOTANUGYIADATOK 
  ADD CONSTRAINT FK_TanuloTanugyiAdatok_MuveszetiAgId_IntezmenyId_TanevId_REF_MuveszetiAg 
  FOREIGN KEY (C_MUVESZETIAGID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_MUVESZETIAG (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOTANUGYIADATOK 
  ADD CONSTRAINT FK_TanuloTanugyiAdatok_TanszakTipusId_IntezmenyId_TanevId_REF_TanszakTipus 
  FOREIGN KEY (C_TANSZAKTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_TANSZAKTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOTANUGYIADATOK 
  ADD CONSTRAINT FK_TanuloTanugyiAdatok_TanterviJellegId_IntezmenyId_TanevId_REF_TanterviJelleg 
  FOREIGN KEY (C_TANTERVIJELLEGID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_TANTERVIJELLEG (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOTANUGYIADATOK 
  ADD CONSTRAINT FK_TanuloTanugyiAdatok_AgazatReszSzakmaTipusId_IntezmenyId_TanevId_REF_AgazatReszSzakmaTipus 
  FOREIGN KEY (C_AGAZATRESZSZAKMATIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_AGAZATRESZSZAKMATIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOTANUGYIADATOK 
  ADD CONSTRAINT FK_TanuloTanugyiAdatok_ReszSzakmaTipusId_IntezmenyId_TanevId_REF_ReszSzakmaTipus 
  FOREIGN KEY (C_RESZSZAKMATIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_RESZSZAKMATIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOTANUGYIADATOK 
  ADD CONSTRAINT FK_TanuloTanugyiAdatok_SzakmaReszSzakmaTipusId_IntezmenyId_TanevId_REF_SzakmaReszSzakmaTipus 
  FOREIGN KEY (C_SZAKMARESZSZAKMATIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_SZAKMARESZSZAKMATIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOTANUGYIADATOK 
  ADD CONSTRAINT FK_TanuloTanugyiAdatok_AgazatAlapOktMegnevTipusId_IntezmenyId_TanevId_REF_AgazatAlapOktMegnevTipus 
  FOREIGN KEY (C_AGAZATALAPOKTMEGNEVTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_AGAZATALAPOKTMEGNEVTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOTANUGYIADATOK 
  ADD CONSTRAINT FK_TanuloTanugyiAdatok_AgazatAlapVizsgaEredTipusId_IntezmenyId_TanevId_REF_AgazatAlapVizsgaEredTipus 
  FOREIGN KEY (C_AGAZATALAPVIZSGAEREDTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_AGAZATALAPVIZSGAEREDTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ELEARNINGELERHETOSEG 
  ADD CONSTRAINT FK_ElearningElerhetoseg_SzerepkorTipusId_IntezmenyId_TanevId_REF_SzerepkorTipus 
  FOREIGN KEY (C_SZEREPKORTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_SZEREPKORTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_IKTATOTTDOKUMENTUM 
  ADD CONSTRAINT FK_IktatottDokumentum_DokumentumKategoria_IntezmenyId_TanevId_REF_DokumentumKategoria 
  FOREIGN KEY (C_DOKUMENTUMKATEGORIA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_DOKUMENTUMKATEGORIA (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_IKTATOTTDOKUMENTUM 
  ADD CONSTRAINT FK_IktatottDokumentum_DokumentumTipus_IntezmenyId_TanevId_REF_DokumentumTipus 
  FOREIGN KEY (C_DOKUMENTUMTIPUS, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_DOKUMENTUMTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_IKTATOTTDOKUMENTUM 
  ADD CONSTRAINT FK_IktatottDokumentum_DokumentumStatusz_IntezmenyId_TanevId_REF_DokumentumStatusz 
  FOREIGN KEY (C_DOKUMENTUMSTATUSZ, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_DOKUMENTUMSTATUSZ (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_IKTATOTTDOKUMENTUM 
  ADD CONSTRAINT FK_IktatottDokumentum_DokumentumElemiSzint_IntezmenyId_TanevId_REF_DokumentumElemiSzint 
  FOREIGN KEY (C_DOKUMENTUMELEMISZINT, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_DOKUMENTUMELEMISZINT (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_DOKUMENTUMKULCSSZO 
  ADD CONSTRAINT FK_DokumentumKulcsszo_DokumentumKulcsszoTipus_IntezmenyId_TanevId_REF_DokumentumKulcsszoTipus 
  FOREIGN KEY (C_DOKUMENTUMKULCSSZOTIPUS, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_DOKUMENTUMKULCSSZOTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_KKTANTARGYKATEGORIA 
  ADD CONSTRAINT FK_KKTantargyKategoria_KKSzakTipusId_IntezmenyId_TanevId_REF_KKSzakTipus 
  FOREIGN KEY (C_KKSZAKTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_KKSZAKTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_KKJAZZZENE 
  ADD CONSTRAINT FK_KKJazzZene_JazzZeneTipusId_IntezmenyId_TanevId_REF_KKAMIJazzZeneTipus 
  FOREIGN KEY (C_JAZZZENETIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_KKAMIJAZZZENETIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_KKKLASSZIKUSZENE 
  ADD CONSTRAINT FK_KKKlasszikusZene_KlasszukusZeneTipusId_IntezmenyId_TanevId_REF_KKAMIKlasszikusTipus 
  FOREIGN KEY (C_KLASSZUKUSZENETIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_KKAMIKLASSZIKUSTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_KKAMIVEGZETTSEG 
  ADD CONSTRAINT FK_KKAMIVegzettseg_KKAMIVegzettsegTipusId_IntezmenyId_TanevId_REF_KKAMIVegzettsegTipus 
  FOREIGN KEY (C_KKAMIVEGZETTSEGTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_KKAMIVEGZETTSEGTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_KKGYOGYPEDVEGZETTSEG 
  ADD CONSTRAINT FK_KKGyogypedVegzettseg_KKGyogypedTerTipusId_IntezmenyId_TanevId_REF_KKGyogypedTerTipus 
  FOREIGN KEY (C_KKGYOGYPEDTERTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_KKGYOGYPEDTERTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_KKNEPZENE 
  ADD CONSTRAINT FK_KKNepzene_NepzeneTipusId_IntezmenyId_TanevId_REF_KKAMINepzeneTipus 
  FOREIGN KEY (C_NEPZENETIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_KKAMINEPZENETIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_KKELEKTROAKUZENE 
  ADD CONSTRAINT FK_KKElektroakuZene_ElektrakuTipusId_IntezmenyId_TanevId_REF_KKAMIElektroakuTipus 
  FOREIGN KEY (C_ELEKTRAKUTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_KKAMIELEKTROAKUTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_KKTERULET 
  ADD CONSTRAINT FK_KKTerulet_AMITeruletTipusId_IntezmenyId_TanevId_REF_KKAMITeruletTipus 
  FOREIGN KEY (C_AMITERULETTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_KKAMITERULETTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_KKTANARVEGZETTSEG 
  ADD CONSTRAINT FK_KKTanarVegzettseg_KKTanarVegzettsegId_IntezmenyId_TanevId_REF_KKVegzettsegTipus 
  FOREIGN KEY (C_KKTANARVEGZETTSEGID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_KKVEGZETTSEGTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_KKTANITOVEZGETTSEG 
  ADD CONSTRAINT FK_KKTanitoVezgettseg_KKTaniotoMuvTerTipusId_IntezmenyId_TanevId_REF_KKTanitoMuvTerTipus 
  FOREIGN KEY (C_KKTANIOTOMUVTERTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_KKTANITOMUVTERTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_KEPESITES 
  ADD CONSTRAINT FK_Kepesites_KepesitesTipusId_IntezmenyId_TanevId_REF_SzakTipus 
  FOREIGN KEY (C_KEPESITESTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_SZAKTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_VEGZETTSEG 
  ADD CONSTRAINT FK_Vegzettseg_VegzettsegTipusId_IntezmenyId_TanevId_REF_VegzettsegTipus 
  FOREIGN KEY (C_VEGZETTSEGTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_VEGZETTSEGTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ERETTSEGIKERDES 
  ADD CONSTRAINT FK_ErettsegiKerdes_ErettsegiSzintId_IntezmenyId_TanevId_REF_ErettsegiSzint 
  FOREIGN KEY (C_ERETTSEGISZINTID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ERETTSEGISZINT (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ERETTSEGIKERDES 
  ADD CONSTRAINT FK_ErettsegiKerdes_ErettsegiTantargyId_IntezmenyId_TanevId_REF_ErettsegiTantargy 
  FOREIGN KEY (C_ERETTSEGITANTARGYID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ERETTSEGITANTARGY (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_LICENCE 
  ADD CONSTRAINT FK_Licence_Function_IntezmenyId_TanevId_REF_LicenceFunkciokTipus 
  FOREIGN KEY (C_FUNCTION, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_LICENCEFUNKCIOKTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_KOZMUSZAMLA 
  ADD CONSTRAINT FK_KozmuSzamla_KozmuSzamlaTipusId_IntezmenyId_TanevId_REF_KozmuSzamlaTipus 
  FOREIGN KEY (C_KOZMUSZAMLATIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_KOZMUSZAMLATIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_KOZMUSZAMLA 
  ADD CONSTRAINT FK_KozmuSzamla_PenznemId_IntezmenyId_TanevId_REF_PenznemTipus 
  FOREIGN KEY (C_PENZNEMID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_PENZNEMTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_MEROHELY 
  ADD CONSTRAINT FK_Merohely_MerohelyTipusId_IntezmenyId_TanevId_REF_MerohelyTipus 
  FOREIGN KEY (C_MEROHELYTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_MEROHELYTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_HITTANADATSZOLGALTATAS 
  ADD CONSTRAINT FK_HittanAdatszolgaltatas_HittanTipusId_IntezmenyId_TanevId_REF_HittanTipus 
  FOREIGN KEY (C_HITTANTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_HITTANTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ORARENDIORATULAJDONSAG 
  ADD CONSTRAINT FK_OrarendiOraTulajdonsag_OraTulajdonsagId_IntezmenyId_TanevId_REF_OraTulajdonsagTipus 
  FOREIGN KEY (C_ORATULAJDONSAGID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ORATULAJDONSAGTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANITASIORATULAJDONSAG 
  ADD CONSTRAINT FK_TanitasiOraTulajdonsag_OraTulajdonsagId_IntezmenyId_TanevId_REF_OraTulajdonsagTipus 
  FOREIGN KEY (C_ORATULAJDONSAGID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ORATULAJDONSAGTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ERTEKELESMONDATBANK 
  ADD CONSTRAINT FK_ErtekelesMondatbank_ErtekelesTipusa_IntezmenyId_TanevId_REF_ErtekelesTipus 
  FOREIGN KEY (C_ERTEKELESTIPUSA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ERTEKELESTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ERTEKELESMONDATBANK 
  ADD CONSTRAINT FK_ErtekelesMondatbank_EvfolyamTipusa_IntezmenyId_TanevId_REF_EvfolyamTipus 
  FOREIGN KEY (C_EVFOLYAMTIPUSA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_EVFOLYAMTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ERTEKELESMONDATBANK 
  ADD CONSTRAINT FK_ErtekelesMondatbank_TipusId_IntezmenyId_TanevId_REF_ErtMondatbankTipus 
  FOREIGN KEY (C_TIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ERTMONDATBANKTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ERETTSEGIEREDMENY 
  ADD CONSTRAINT FK_ErettsegiEredmeny_ErettsegiSzint_IntezmenyId_TanevId_REF_ErettsegiSzint 
  FOREIGN KEY (C_ERETTSEGISZINT, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ERETTSEGISZINT (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ERETTSEGIEREDMENY 
  ADD CONSTRAINT FK_ErettsegiEredmeny_ErettsegiTantargy_IntezmenyId_TanevId_REF_ErettsegiTantargy 
  FOREIGN KEY (C_ERETTSEGITANTARGY, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ERETTSEGITANTARGY (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ERETTSEGIEREDMENY 
  ADD CONSTRAINT FK_ErettsegiEredmeny_ErettsegiTipus_IntezmenyId_TanevId_REF_ErettsegiTipus 
  FOREIGN KEY (C_ERETTSEGITIPUS, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ERETTSEGITIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ERETTSEGITANTARGYADATOK 
  ADD CONSTRAINT FK_ErettsegiTantargyAdatok_ErettsegiSzint_IntezmenyId_TanevId_REF_ErettsegiSzint 
  FOREIGN KEY (C_ERETTSEGISZINT, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ERETTSEGISZINT (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ERETTSEGITANTARGYADATOK 
  ADD CONSTRAINT FK_ErettsegiTantargyAdatok_ErettsegiTantargy_IntezmenyId_TanevId_REF_ErettsegiTantargy 
  FOREIGN KEY (C_ERETTSEGITANTARGY, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ERETTSEGITANTARGY (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TOVABBIMUNKAUGYIADATOK 
  ADD CONSTRAINT FK_TovabbiMunkaugyiAdatok_BesorolasiFokozat_IntezmenyId_TanevId_REF_BesorolasiFokozatTipus 
  FOREIGN KEY (C_BESOROLASIFOKOZAT, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_BESOROLASIFOKOZATTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TOVABBIMUNKAUGYIADATOK 
  ADD CONSTRAINT FK_TovabbiMunkaugyiAdatok_MunkaidoKedvezmenyOka_IntezmenyId_TanevId_REF_MunkaidoKedvezmenyOka 
  FOREIGN KEY (C_MUNKAIDOKEDVEZMENYOKA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_MUNKAIDOKEDVEZMENYOKA (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TOVABBIMUNKAUGYIADATOK 
  ADD CONSTRAINT FK_TovabbiMunkaugyiAdatok_MunkakorTipusa_IntezmenyId_TanevId_REF_MunkakorTipus 
  FOREIGN KEY (C_MUNKAKORTIPUSA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_MUNKAKORTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TOVABBIMUNKAUGYIADATOK 
  ADD CONSTRAINT FK_TovabbiMunkaugyiAdatok_MunkaviszonyTipusa_IntezmenyId_TanevId_REF_MunkaviszonyTipus 
  FOREIGN KEY (C_MUNKAVISZONYTIPUSA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_MUNKAVISZONYTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TOVABBIMUNKAUGYIADATOK 
  ADD CONSTRAINT FK_TovabbiMunkaugyiAdatok_FoglalkoztatasTipus_IntezmenyId_TanevId_REF_FoglalkoztatasTipusa 
  FOREIGN KEY (C_FOGLALKOZTATASTIPUS, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_FOGLALKOZTATASTIPUSA (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TOVABBIMUNKAUGYIADATOK 
  ADD CONSTRAINT FK_TovabbiMunkaugyiAdatok_VezetoiOraszamok_IntezmenyId_TanevId_REF_VezetoiOraszamokTipus 
  FOREIGN KEY (C_VEZETOIORASZAMOK, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_VEZETOIORASZAMOKTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_PEDAGOGUSIKTADATSZOLGALTATAS 
  ADD CONSTRAINT FK_PedagogusIKTAdatszolgaltatas_ElsodlegesIKTEszkoze_IntezmenyId_TanevId_REF_ElsodlegesIKTEszkoz 
  FOREIGN KEY (C_ELSODLEGESIKTESZKOZE, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ELSODLEGESIKTESZKOZ (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_PEDAGOGUSIKTADATSZOLGALTATAS 
  ADD CONSTRAINT FK_PedagogusIKTAdatszolgaltatas_IKTEszkozhasznalatModja_IntezmenyId_TanevId_REF_IKTEszkozhasznalatMod 
  FOREIGN KEY (C_IKTESZKOZHASZNALATMODJA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_IKTESZKOZHASZNALATMOD (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_PEDAGOGUSIKTADATSZOLGALTATAS 
  ADD CONSTRAINT FK_PedagogusIKTAdatszolgaltatas_IKTKompetenciaSzintje_IntezmenyId_TanevId_REF_IKTKompetenciaSzint 
  FOREIGN KEY (C_IKTKOMPETENCIASZINTJE, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_IKTKOMPETENCIASZINT (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NEBULO 
  ADD CONSTRAINT FK_Nebulo_Allampolgarsaga_IntezmenyId_TanevId_REF_Allampolgarsag 
  FOREIGN KEY (C_ALLAMPOLGARSAGA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ALLAMPOLGARSAG (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NEBULO 
  ADD CONSTRAINT FK_Nebulo_Allampolgarsaga2_IntezmenyId_TanevId_REF_Allampolgarsag 
  FOREIGN KEY (C_ALLAMPOLGARSAGA2, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ALLAMPOLGARSAG (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NEBULO 
  ADD CONSTRAINT FK_Nebulo_Anyanyelve_IntezmenyId_TanevId_REF_Anyanyelv 
  FOREIGN KEY (C_ANYANYELVE, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ANYANYELV (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NEBULO 
  ADD CONSTRAINT FK_Nebulo_FelvetelStatusza_IntezmenyId_TanevId_REF_FelvetelStatuszaTipus 
  FOREIGN KEY (C_FELVETELSTATUSZA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_FELVETELSTATUSZATIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NEBULO 
  ADD CONSTRAINT FK_Nebulo_Neme_IntezmenyId_TanevId_REF_Nem 
  FOREIGN KEY (C_NEME, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_NEM (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NEBULO 
  ADD CONSTRAINT FK_Nebulo_SzuletesiOrszag_IntezmenyId_TanevId_REF_OrszagTipus 
  FOREIGN KEY (C_SZULETESIORSZAG, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ORSZAGTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NEBULO 
  ADD CONSTRAINT FK_Nebulo_Tagozat_IntezmenyId_TanevId_REF_TagozatTipus 
  FOREIGN KEY (C_TAGOZAT, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_TAGOZATTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NEBULO 
  ADD CONSTRAINT FK_Nebulo_TKRokonsagiFoka_IntezmenyId_TanevId_REF_RokonsagiFok 
  FOREIGN KEY (C_TKROKONSAGIFOKA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ROKONSAGIFOK (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NEBULO 
  ADD CONSTRAINT FK_Nebulo_TKRokonsagiFoka2_IntezmenyId_TanevId_REF_RokonsagiFok 
  FOREIGN KEY (C_TKROKONSAGIFOKA2, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ROKONSAGIFOK (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NEBULO 
  ADD CONSTRAINT FK_Nebulo_KirSzolgaltatasTipusId_IntezmenyId_TanevId_REF_KirSzolgaltatasTipus 
  FOREIGN KEY (C_KIRSZOLGALTATASTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_KIRSZOLGALTATASTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NEBULO 
  ADD CONSTRAINT FK_Nebulo_OrszagTipusId_IntezmenyId_TanevId_REF_OrszagTipus 
  FOREIGN KEY (C_ORSZAGTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ORSZAGTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NEBULO 
  ADD CONSTRAINT FK_Nebulo_THOrszagTipusId_IntezmenyId_TanevId_REF_OrszagTipus 
  FOREIGN KEY (C_THORSZAGTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ORSZAGTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NEBULO 
  ADD CONSTRAINT FK_Nebulo_TKOrszagTipusId_IntezmenyId_TanevId_REF_OrszagTipus 
  FOREIGN KEY (C_TKORSZAGTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ORSZAGTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NEBULO 
  ADD CONSTRAINT FK_Nebulo_TKOrszagTipusId2_IntezmenyId_TanevId_REF_OrszagTipus 
  FOREIGN KEY (C_TKORSZAGTIPUSID2, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ORSZAGTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NEBULO 
  ADD CONSTRAINT FK_Nebulo_FelekezetTipusId_IntezmenyId_TanevId_REF_FelekezetTipus 
  FOREIGN KEY (C_FELEKEZETTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_FELEKEZETTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NEBULO 
  ADD CONSTRAINT FK_Nebulo_HatranyosHelyzetTipusId_IntezmenyId_TanevId_REF_HatranyosHelyzetTipus 
  FOREIGN KEY (C_HATRANYOSHELYZETTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_HATRANYOSHELYZETTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NEBULO 
  ADD CONSTRAINT FK_Nebulo_NemzetisegTipusId_IntezmenyId_TanevId_REF_NemzetisegTipus 
  FOREIGN KEY (C_NEMZETISEGTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_NEMZETISEGTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NEBULO 
  ADD CONSTRAINT FK_Nebulo_TKJogalapTipus2Id_IntezmenyId_TanevId_REF_TKJogalapTipus 
  FOREIGN KEY (C_TKJOGALAPTIPUS2ID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_TKJOGALAPTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NEBULO 
  ADD CONSTRAINT FK_Nebulo_TKJogalapTipusId_IntezmenyId_TanevId_REF_TKJogalapTipus 
  FOREIGN KEY (C_TKJOGALAPTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_TKJOGALAPTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ADATSZOLGALTATASENAPLO 
  ADD CONSTRAINT FK_AdatszolgaltatasENaplo_ENaploForrasa_IntezmenyId_TanevId_REF_ENaploForras 
  FOREIGN KEY (C_ENAPLOFORRASA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ENAPLOFORRAS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ADATSZOLGALTATASENAPLO 
  ADD CONSTRAINT FK_AdatszolgaltatasENaplo_ENaploInfraja_IntezmenyId_TanevId_REF_ENaploInfra 
  FOREIGN KEY (C_ENAPLOINFRAJA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ENAPLOINFRA (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ADATSZOLGALTATASENAPLO 
  ADD CONSTRAINT FK_AdatszolgaltatasENaplo_ENaploTipusa_IntezmenyId_TanevId_REF_ENaploTipus 
  FOREIGN KEY (C_ENAPLOTIPUSA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ENAPLOTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ADATSZOLGALTATASENAPLO 
  ADD CONSTRAINT FK_AdatszolgaltatasENaplo_SzerzodoSzemelyPozicioja_IntezmenyId_TanevId_REF_SzerzodoSzemelyPozicio 
  FOREIGN KEY (C_SZERZODOSZEMELYPOZICIOJA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_SZERZODOSZEMELYPOZICIO (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ADATSZOLGALTATASENAPLO 
  ADD CONSTRAINT FK_AdatszolgaltatasENaplo_ENaploHasznalata_IntezmenyId_TanevId_REF_ENaploHasznalat 
  FOREIGN KEY (C_ENAPLOHASZNALATA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ENAPLOHASZNALAT (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ADATSZOLGALTATASENAPLO 
  ADD CONSTRAINT FK_AdatszolgaltatasENaplo_WiFiEleres_IntezmenyId_TanevId_REF_WiFiEleres 
  FOREIGN KEY (C_WIFIELERES, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_WIFIELERES (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NEMKOTOTTMUNKAIDO 
  ADD CONSTRAINT FK_NemKotottMunkaido_TevekenysegTipusa_IntezmenyId_TanevId_REF_TevekenysegTipus 
  FOREIGN KEY (C_TEVEKENYSEGTIPUSA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_TEVEKENYSEGTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NEMKOTOTTMUNKAIDO 
  ADD CONSTRAINT FK_NemKotottMunkaido_Hetirend_IntezmenyId_TanevId_REF_HetiRendTipus 
  FOREIGN KEY (C_HETIREND, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_HETIRENDTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ESLADAT 
  ADD CONSTRAINT FK_ESLAdat_Tipus_IntezmenyId_TanevId_REF_ESLAdatTipus 
  FOREIGN KEY (C_TIPUS, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ESLADATTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NAPTARIHET 
  ADD CONSTRAINT FK_NaptariHet_HetiRend_IntezmenyId_TanevId_REF_HetiRendTipus 
  FOREIGN KEY (C_HETIREND, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_HETIRENDTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_HELYETTESITESIIDOSZAK 
  ADD CONSTRAINT FK_HelyettesitesiIdoszak_HelyettesitesTipus_IntezmenyId_TanevId_REF_HelyettesitesTipus 
  FOREIGN KEY (C_HELYETTESITESTIPUS, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_HELYETTESITESTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_JOGOSULTSAG 
  ADD CONSTRAINT FK_Jogosultsag_SzerepkorTipus_IntezmenyId_TanevId_REF_SzerepkorTipus 
  FOREIGN KEY (C_SZEREPKORTIPUS, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_SZEREPKORTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOKOZOSSEGISZOLGALAT 
  ADD CONSTRAINT FK_TanuloKozossegiSzolgalat_KozossegiSzolgalatTipusa_IntezmenyId_TanevId_REF_KozossegiSzolgalatTipus 
  FOREIGN KEY (C_KOZOSSEGISZOLGALATTIPUSA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_KOZOSSEGISZOLGALATTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_MUNKAUGYIADATOK 
  ADD CONSTRAINT FK_MunkaugyiAdatok_MunkakorTipusa_IntezmenyId_TanevId_REF_MunkakorTipus 
  FOREIGN KEY (C_MUNKAKORTIPUSA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_MUNKAKORTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_MUNKAUGYIADATOK 
  ADD CONSTRAINT FK_MunkaugyiAdatok_MunkaviszonyTipusa_IntezmenyId_TanevId_REF_MunkaviszonyTipus 
  FOREIGN KEY (C_MUNKAVISZONYTIPUSA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_MUNKAVISZONYTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_MUNKAUGYIADATOK 
  ADD CONSTRAINT FK_MunkaugyiAdatok_PedagogusStatusza_IntezmenyId_TanevId_REF_PedagogusStatusz 
  FOREIGN KEY (C_PEDAGOGUSSTATUSZA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_PEDAGOGUSSTATUSZ (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_MUNKAUGYIADATOK 
  ADD CONSTRAINT FK_MunkaugyiAdatok_BesorolasiFokozat_IntezmenyId_TanevId_REF_BesorolasiFokozatTipus 
  FOREIGN KEY (C_BESOROLASIFOKOZAT, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_BESOROLASIFOKOZATTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_MUNKAUGYIADATOK 
  ADD CONSTRAINT FK_MunkaugyiAdatok_MunkaidoKedvezmenyOka_IntezmenyId_TanevId_REF_MunkaidoKedvezmenyOka 
  FOREIGN KEY (C_MUNKAIDOKEDVEZMENYOKA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_MUNKAIDOKEDVEZMENYOKA (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_MUNKAUGYIADATOK 
  ADD CONSTRAINT FK_MunkaugyiAdatok_FoglalkoztatasTipus_IntezmenyId_TanevId_REF_FoglalkoztatasTipusa 
  FOREIGN KEY (C_FOGLALKOZTATASTIPUS, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_FOGLALKOZTATASTIPUSA (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_MUNKAUGYIADATOK 
  ADD CONSTRAINT FK_MunkaugyiAdatok_VezetoiOraszamok_IntezmenyId_TanevId_REF_VezetoiOraszamokTipus 
  FOREIGN KEY (C_VEZETOIORASZAMOK, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_VEZETOIORASZAMOKTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_MUNKAUGYIADATOK 
  ADD CONSTRAINT FK_MunkaugyiAdatok_EgyebTevekenysegekTipusId_IntezmenyId_TanevId_REF_EgyebTevekenysegekTipus 
  FOREIGN KEY (C_EGYEBTEVEKENYSEGEKTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_EGYEBTEVEKENYSEGEKTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_MUNKAUGYIADATOK 
  ADD CONSTRAINT FK_MunkaugyiAdatok_MunkaugyTorvenyiHatalyTipusId_IntezmenyId_TanevId_REF_MunkaugyTorvenyiHatalyTipus 
  FOREIGN KEY (C_MUNKAUGYTORVENYIHATALYTIPUSI, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_MUNKAUGYTORVENYIHATALYTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_MUNKAUGYIADATOK 
  ADD CONSTRAINT FK_MunkaugyiAdatok_KepesitesTipusId_IntezmenyId_TanevId_REF_KepesitesTipus 
  FOREIGN KEY (C_KEPESITESTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_KEPESITESTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_MUNKAUGYIADATOK 
  ADD CONSTRAINT FK_MunkaugyiAdatok_NyugdijTipus_IntezmenyId_TanevId_REF_NyugdijTipus 
  FOREIGN KEY (C_NYUGDIJTIPUS, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_NYUGDIJTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_FELADATELLATASIHELY 
  ADD CONSTRAINT FK_FeladatEllatasiHely_OktatasiNevelesiFeladatTipus_IntezmenyId_TanevId_REF_OktatasiNevelesiFeladat 
  FOREIGN KEY (C_OKTATASINEVELESIFELADATTIPUS, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_OKTATASINEVELESIFELADAT (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_RENDSZERBEALLITAS 
  ADD CONSTRAINT FK_RendszerBeallitas_BeallitasTipus_IntezmenyId_TanevId_REF_RendszerBeallitasTipus 
  FOREIGN KEY (C_BEALLITASTIPUS, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_RENDSZERBEALLITASTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_RENDSZERBEALLITAS 
  ADD CONSTRAINT FK_RendszerBeallitas_ErtekTipus_IntezmenyId_TanevId_REF_SystemSettingsControlType 
  FOREIGN KEY (C_ERTEKTIPUS, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_SYSTEMSETTINGSCONTROLTYPE (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ORATERV 
  ADD CONSTRAINT FK_OraTerv_Evfolyam_IntezmenyId_TanevId_REF_EvfolyamTipus 
  FOREIGN KEY (C_EVFOLYAM, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_EVFOLYAMTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANARIATLAGSULY 
  ADD CONSTRAINT FK_TanariAtlagSuly_ErtekelesModId_IntezmenyId_TanevId_REF_ErtekelesMod 
  FOREIGN KEY (C_ERTEKELESMODID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ERTEKELESMOD (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ERTESITESGENERALASTORTENET 
  ADD CONSTRAINT FK_ErtesitesGeneralasTortenet_ErtesitesTipusa_IntezmenyId_TanevId_REF_ErtesitesTipus 
  FOREIGN KEY (C_ERTESITESTIPUSA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ERTESITESTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ERTESITES 
  ADD CONSTRAINT FK_Ertesites_SzinTipus_IntezmenyId_TanevId_REF_ErtesitesSzinTipus 
  FOREIGN KEY (C_SZINTIPUS, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ERTESITESSZINTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ERTESITES 
  ADD CONSTRAINT FK_Ertesites_Tipus_IntezmenyId_TanevId_REF_ErtesitesTipus 
  FOREIGN KEY (C_TIPUS, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ERTESITESTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_PEDAGOGUSELETPALYAMODELL 
  ADD CONSTRAINT FK_PedagogusEletpalyamodell_Fokozat_IntezmenyId_TanevId_REF_EletpalyamodellFokozatTipus 
  FOREIGN KEY (C_FOKOZAT, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ELETPALYAMODELLFOKOZATTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_PEDAGOGUSELETPALYAMODELL 
  ADD CONSTRAINT FK_PedagogusEletpalyamodell_PortfolioStatusz_IntezmenyId_TanevId_REF_EletpalyamodellStatuszok 
  FOREIGN KEY (C_PORTFOLIOSTATUSZ, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ELETPALYAMODELLSTATUSZOK (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_IGAZOLAS 
  ADD CONSTRAINT FK_Igazolas_IgazolasTipusa_IntezmenyId_TanevId_REF_IgazolasTipus 
  FOREIGN KEY (C_IGAZOLASTIPUSA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_IGAZOLASTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOESEMENY 
  ADD CONSTRAINT FK_TanuloEsemeny_Tipus_IntezmenyId_TanevId_REF_EsemenyTipus 
  FOREIGN KEY (C_TIPUS, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ESEMENYTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOMULASZTAS 
  ADD CONSTRAINT FK_TanuloMulasztas_Tipus_IntezmenyId_TanevId_REF_MulasztasTipus 
  FOREIGN KEY (C_TIPUS, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_MULASZTASTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOMULASZTAS 
  ADD CONSTRAINT FK_TanuloMulasztas_IgazolasTipusa_IntezmenyId_TanevId_REF_IgazolasTipus 
  FOREIGN KEY (C_IGAZOLASTIPUSA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_IGAZOLASTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOERTEKELES 
  ADD CONSTRAINT FK_TanuloErtekeles_TipusId_IntezmenyId_TanevId_REF_ErtekelesTipus 
  FOREIGN KEY (C_TIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ERTEKELESTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOERTEKELES 
  ADD CONSTRAINT FK_TanuloErtekeles_ErtekelesOsztalyzatId_IntezmenyId_TanevId_REF_OsztalyzatTipus 
  FOREIGN KEY (C_ERTEKELESOSZTALYZATID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_OSZTALYZATTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOERTEKELES 
  ADD CONSTRAINT FK_TanuloErtekeles_ErtekelesModId_IntezmenyId_TanevId_REF_ErtekelesMod 
  FOREIGN KEY (C_ERTEKELESMODID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ERTEKELESMOD (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOERTEKELES 
  ADD CONSTRAINT FK_TanuloErtekeles_MagatartasErtekId_IntezmenyId_TanevId_REF_MagatartasErtekelesTipus 
  FOREIGN KEY (C_MAGATARTASERTEKID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_MAGATARTASERTEKELESTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOERTEKELES 
  ADD CONSTRAINT FK_TanuloErtekeles_MagatartasOsztalyzatId_IntezmenyId_TanevId_REF_OsztalyzatTipus 
  FOREIGN KEY (C_MAGATARTASOSZTALYZATID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_OSZTALYZATTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOERTEKELES 
  ADD CONSTRAINT FK_TanuloErtekeles_SzorgalomErtekId_IntezmenyId_TanevId_REF_SzorgalomErtekelesTipus 
  FOREIGN KEY (C_SZORGALOMERTEKID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_SZORGALOMERTEKELESTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOERTEKELES 
  ADD CONSTRAINT FK_TanuloErtekeles_SzorgalomOsztalyzatId_IntezmenyId_TanevId_REF_OsztalyzatTipus 
  FOREIGN KEY (C_SZORGALOMOSZTALYZATID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_OSZTALYZATTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANITASIORA 
  ADD CONSTRAINT FK_TanitasiOra_HelyettesitesTipusa_IntezmenyId_TanevId_REF_HelyettesitesTipus 
  FOREIGN KEY (C_HELYETTESITESTIPUSA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_HELYETTESITESTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANITASIORA 
  ADD CONSTRAINT FK_TanitasiOra_HetNapja_IntezmenyId_TanevId_REF_HetNapjaTipus 
  FOREIGN KEY (C_HETNAPJA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_HETNAPJATIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANITASIORA 
  ADD CONSTRAINT FK_TanitasiOra_DigEszkozTipusId_IntezmenyId_TanevId_REF_DigEszkozTipus 
  FOREIGN KEY (C_DIGESZKOZTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_DIGESZKOZTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANITASIORA 
  ADD CONSTRAINT FK_TanitasiOra_DigPlatformTipusId_IntezmenyId_TanevId_REF_DigPlatformTipus 
  FOREIGN KEY (C_DIGPLATFORMTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_DIGPLATFORMTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NAPTARINAP 
  ADD CONSTRAINT FK_NaptariNap_HetiRend_IntezmenyId_TanevId_REF_HetiRendTipus 
  FOREIGN KEY (C_HETIREND, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_HETIRENDTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NAPTARINAP 
  ADD CONSTRAINT FK_NaptariNap_NapTipusa_IntezmenyId_TanevId_REF_NapTipus 
  FOREIGN KEY (C_NAPTIPUSA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_NAPTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NAPTARINAP 
  ADD CONSTRAINT FK_NaptariNap_AlapHetiRend_IntezmenyId_TanevId_REF_HetiRendTipus 
  FOREIGN KEY (C_ALAPHETIREND, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_HETIRENDTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_NAPTARINAP 
  ADD CONSTRAINT FK_NaptariNap_AlapNapTipusa_IntezmenyId_TanevId_REF_NapTipus 
  FOREIGN KEY (C_ALAPNAPTIPUSA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_NAPTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ORARENDIORA 
  ADD CONSTRAINT FK_OrarendiOra_Hetirend_IntezmenyId_TanevId_REF_HetiRendTipus 
  FOREIGN KEY (C_HETIREND, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_HETIRENDTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ORARENDIORA 
  ADD CONSTRAINT FK_OrarendiOra_HetNapja_IntezmenyId_TanevId_REF_HetNapjaTipus 
  FOREIGN KEY (C_HETNAPJA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_HETNAPJATIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULOCSOPORT 
  ADD CONSTRAINT FK_TanuloCsoport_JogviszonyTipusID_IntezmenyId_TanevId_REF_JogviszonyTipus 
  FOREIGN KEY (C_JOGVISZONYTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_JOGVISZONYTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANEVRENDJE 
  ADD CONSTRAINT FK_TanevRendje_HetiRend_IntezmenyId_TanevId_REF_HetiRendTipus 
  FOREIGN KEY (C_HETIREND, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_HETIRENDTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANEVRENDJE 
  ADD CONSTRAINT FK_TanevRendje_HetNapja_IntezmenyId_TanevId_REF_HetNapjaTipus 
  FOREIGN KEY (C_HETNAPJA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_HETNAPJATIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANEVRENDJE 
  ADD CONSTRAINT FK_TanevRendje_NapTipusa_IntezmenyId_TanevId_REF_NapTipus 
  FOREIGN KEY (C_NAPTIPUSA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_NAPTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_FOGLALKOZAS 
  ADD CONSTRAINT FK_Foglalkozas_FoglalkozasTipusa_IntezmenyId_TanevId_REF_FoglalkozasTipus 
  FOREIGN KEY (C_FOGLALKOZASTIPUSA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_FOGLALKOZASTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_EVFOLYAMTIPUS 
  ADD CONSTRAINT FK_EvfolyamTipus_KovetkezoEvfolyamTipusId_AlintezmenyId_AltanevId_REF_EvfolyamTipus 
  FOREIGN KEY (C_KOVETKEZOEVFOLYAMTIPUSID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_EVFOLYAMTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANTARGY 
  ADD CONSTRAINT FK_Tantargy_TargyKategoria_IntezmenyId_TanevId_REF_TargyKategoriaTipus 
  FOREIGN KEY (C_TARGYKATEGORIA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_TARGYKATEGORIATIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANTARGY 
  ADD CONSTRAINT FK_Tantargy_EslTantargyKategoriaId_IntezmenyId_TanevId_REF_ESLTantargykategoria 
  FOREIGN KEY (C_ESLTANTARGYKATEGORIAID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ESLTANTARGYKATEGORIA (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANTARGY 
  ADD CONSTRAINT FK_Tantargy_MufajTipusId_IntezmenyId_TanevId_REF_MufajTipus 
  FOREIGN KEY (C_MUFAJTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_MUFAJTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANTARGY 
  ADD CONSTRAINT FK_Tantargy_TanszakTipusId_IntezmenyId_TanevId_REF_TanszakTipus 
  FOREIGN KEY (C_TANSZAKTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_TANSZAKTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANTARGY 
  ADD CONSTRAINT FK_Tantargy_MuveszetiAgId_IntezmenyId_TanevId_REF_MuveszetiAg 
  FOREIGN KEY (C_MUVESZETIAGID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_MUVESZETIAG (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANTERV 
  ADD CONSTRAINT FK_Tanterv_CsoportTipusa_IntezmenyId_TanevId_REF_CsoportTipus 
  FOREIGN KEY (C_CSOPORTTIPUSA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_CSOPORTTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANTERV 
  ADD CONSTRAINT FK_Tanterv_Evfolyamig_IntezmenyId_TanevId_REF_EvfolyamTipus 
  FOREIGN KEY (C_EVFOLYAMIG, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_EVFOLYAMTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANTERV 
  ADD CONSTRAINT FK_Tanterv_Evfolyamtol_IntezmenyId_TanevId_REF_EvfolyamTipus 
  FOREIGN KEY (C_EVFOLYAMTOL, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_EVFOLYAMTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_OKTATASINEVELESIFELADAT 
  ADD CONSTRAINT FK_OktatasiNevelesiFeladat_FeladatKategoriaId_AlintezmenyId_AltanevId_REF_OktNevelesiKategoria 
  FOREIGN KEY (C_FELADATKATEGORIAID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_OKTNEVELESIKATEGORIA (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_OSZTALYCSOPORT 
  ADD CONSTRAINT FK_OsztalyCsoport_EvfolyamTipusa_IntezmenyId_TanevId_REF_EvfolyamTipus 
  FOREIGN KEY (C_EVFOLYAMTIPUSA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_EVFOLYAMTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_OSZTALYCSOPORT 
  ADD CONSTRAINT FK_OsztalyCsoport_FeladatKategoriaId_IntezmenyId_TanevId_REF_OktNevelesiKategoria 
  FOREIGN KEY (C_FELADATKATEGORIAID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_OKTNEVELESIKATEGORIA (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_OSZTALYCSOPORT 
  ADD CONSTRAINT FK_OsztalyCsoport_MuveszetiAgId_IntezmenyId_TanevId_REF_MuveszetiAg 
  FOREIGN KEY (C_MUVESZETIAGID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_MUVESZETIAG (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_OSZTALYCSOPORT 
  ADD CONSTRAINT FK_OsztalyCsoport_ZenemuveszetiAgTipusId_IntezmenyId_TanevId_REF_ZenemuveszetiAgTipus 
  FOREIGN KEY (C_ZENEMUVESZETIAGTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ZENEMUVESZETIAGTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_OSZTALYCSOPORT 
  ADD CONSTRAINT FK_OsztalyCsoport_KepzesiForma_IntezmenyId_TanevId_REF_TanterviJelleg 
  FOREIGN KEY (C_KEPZESIFORMA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_TANTERVIJELLEG (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_OSZTALY 
  ADD CONSTRAINT FK_Osztaly_Agazat_AlintezmenyId_AltanevId_REF_AgazatTipus 
  FOREIGN KEY (C_AGAZAT, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_AGAZATTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_OSZTALY 
  ADD CONSTRAINT FK_Osztaly_Reszszakkepesites_AlintezmenyId_AltanevId_REF_ReszszakkepesitesTipus 
  FOREIGN KEY (C_RESZSZAKKEPESITES, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_RESZSZAKKEPESITESTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_OSZTALY 
  ADD CONSTRAINT FK_Osztaly_Szakkepesites_AlintezmenyId_AltanevId_REF_SzakkepesitesTipus 
  FOREIGN KEY (C_SZAKKEPESITES, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_SZAKKEPESITESTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_OSZTALY 
  ADD CONSTRAINT FK_Osztaly_SzakmaCsoport_AlintezmenyId_AltanevId_REF_SzakmacsoportTipus 
  FOREIGN KEY (C_SZAKMACSOPORT, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_SZAKMACSOPORTTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_OSZTALY 
  ADD CONSTRAINT FK_Osztaly_GimnaziumiEvfolyamTipusId_AlintezmenyId_AltanevId_REF_GimnaziumiEvfolyamTipus 
  FOREIGN KEY (C_GIMNAZIUMIEVFOLYAMTIPUSID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_GIMNAZIUMIEVFOLYAMTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_OSZTALY 
  ADD CONSTRAINT FK_Osztaly_AranyJanosProgramTipusId_AlintezmenyId_AltanevId_REF_AranyJanosProgramTipus 
  FOREIGN KEY (C_ARANYJANOSPROGRAMTIPUSID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_ARANYJANOSPROGRAMTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_OSZTALY 
  ADD CONSTRAINT FK_Osztaly_JogviszonyTipusId_AlintezmenyId_AltanevId_REF_JogviszonyTipus 
  FOREIGN KEY (C_JOGVISZONYTIPUSID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_JOGVISZONYTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_OSZTALY 
  ADD CONSTRAINT FK_Osztaly_AgazatUjSzktTipusId_AlintezmenyId_AltanevId_REF_AgazatUjSzktTipus 
  FOREIGN KEY (C_AGAZATUJSZKTTIPUSID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_AGAZATUJSZKTTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_OSZTALY 
  ADD CONSTRAINT FK_Osztaly_SzakmairanyTipusId_AlintezmenyId_AltanevId_REF_SzakmairanyTipus 
  FOREIGN KEY (C_SZAKMAIRANYTIPUSID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_SZAKMAIRANYTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_OSZTALY 
  ADD CONSTRAINT FK_Osztaly_SzakmaTipusId_AlintezmenyId_AltanevId_REF_SzakmaTipus 
  FOREIGN KEY (C_SZAKMATIPUSID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_SZAKMATIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_OSZTALY 
  ADD CONSTRAINT FK_Osztaly_SzakiranyNktTipusId_AlintezmenyId_AltanevId_REF_SzakiranyNktTipus 
  FOREIGN KEY (C_SZAKIRANYNKTTIPUSID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_SZAKIRANYNKTTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_OSZTALY 
  ADD CONSTRAINT FK_Osztaly_SzakkepesitesNktTipusId_AlintezmenyId_AltanevId_REF_SzakkepesitesNktTipus 
  FOREIGN KEY (C_SZAKKEPESITESNKTTIPUSID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_SZAKKEPESITESNKTTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_OSZTALY 
  ADD CONSTRAINT FK_Osztaly_TanulmanyiTeruletNktTipusId_AlintezmenyId_AltanevId_REF_TanulmanyiTeruletNktTipus 
  FOREIGN KEY (C_TANULMANYITERULETNKTTIPUSID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_TANULMANYITERULETNKTTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_OSZTALY 
  ADD CONSTRAINT FK_Osztaly_MufajTipusId_AlintezmenyId_AltanevId_REF_MufajTipus 
  FOREIGN KEY (C_MUFAJTIPUSID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_MUFAJTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_OSZTALY 
  ADD CONSTRAINT FK_Osztaly_TanszakTipusId_AlintezmenyId_AltanevId_REF_TanszakTipus 
  FOREIGN KEY (C_TANSZAKTIPUSID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_TANSZAKTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_CSOPORT 
  ADD CONSTRAINT FK_Csoport_Tipusa_AlintezmenyId_AltanevId_REF_CsoportTipus 
  FOREIGN KEY (C_TIPUSA, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_CSOPORTTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_INTEZMENYADATOK 
  ADD CONSTRAINT FK_IntezmenyAdatok_KretaTipus_IntezmenyId_TanevId_REF_KretaTipus 
  FOREIGN KEY (C_KRETATIPUS, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_KRETATIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_INTEZMENYADATOK 
  ADD CONSTRAINT FK_IntezmenyAdatok_SniNevelesiFormaTipusId_IntezmenyId_TanevId_REF_SniTanuloNevelesiFormaTipus 
  FOREIGN KEY (C_SNINEVELESIFORMATIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_SNITANULONEVELESIFORMATIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_IngyenesTankonvyEllatasa_AlintezmenyId_AltanevId_REF_IngyenesTankonyvEllatas 
  FOREIGN KEY (C_INGYENESTANKONVYELLATASA, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_INGYENESTANKONYVELLATAS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_MagantanulosaganakOka_AlintezmenyId_AltanevId_REF_MagantanulosagOka 
  FOREIGN KEY (C_MAGANTANULOSAGANAKOKA, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_MAGANTANULOSAGOKA (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_TestnevelesTipusa_AlintezmenyId_AltanevId_REF_TestnevelesTipus 
  FOREIGN KEY (C_TESTNEVELESTIPUSA, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_TESTNEVELESTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_EtkezesiKedvezmeny_AlintezmenyId_AltanevId_REF_EtkezesiKedvezmenyTipus 
  FOREIGN KEY (C_ETKEZESIKEDVEZMENY, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_ETKEZESIKEDVEZMENYTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_HatranyosHelyzetu_AlintezmenyId_AltanevId_REF_HatranyosHelyzetTipus 
  FOREIGN KEY (C_HATRANYOSHELYZETU, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_HATRANYOSHELYZETTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_Vallasa_AlintezmenyId_AltanevId_REF_Vallas 
  FOREIGN KEY (C_VALLASA, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_VALLAS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_ErtelmiFogyatekos_AlintezmenyId_AltanevId_REF_ErtelmiFogyatekosTipus 
  FOREIGN KEY (C_ERTELMIFOGYATEKOS, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_ERTELMIFOGYATEKOSTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_HallasSerult_AlintezmenyId_AltanevId_REF_HallasserultTipus 
  FOREIGN KEY (C_HALLASSERULT, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_HALLASSERULTTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_LatasSerult_AlintezmenyId_AltanevId_REF_LatasserultTipus 
  FOREIGN KEY (C_LATASSERULT, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_LATASSERULTTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_Agazat_AlintezmenyId_AltanevId_REF_AgazatTipus 
  FOREIGN KEY (C_AGAZAT, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_AGAZATTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_Reszszakkepesites_AlintezmenyId_AltanevId_REF_ReszszakkepesitesTipus 
  FOREIGN KEY (C_RESZSZAKKEPESITES, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_RESZSZAKKEPESITESTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_Szakkepesites_AlintezmenyId_AltanevId_REF_SzakkepesitesTipus 
  FOREIGN KEY (C_SZAKKEPESITES, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_SZAKKEPESITESTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_Szakmacsoport_AlintezmenyId_AltanevId_REF_SzakmacsoportTipus 
  FOREIGN KEY (C_SZAKMACSOPORT, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_SZAKMACSOPORTTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_TanuloEvfolyamTipus_AlintezmenyId_AltanevId_REF_EvfolyamTipus 
  FOREIGN KEY (C_TANULOEVFOLYAMTIPUS, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_EVFOLYAMTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_TanterviJellemzoId_AlintezmenyId_AltanevId_REF_TanterviJellemzoTipus 
  FOREIGN KEY (C_TANTERVIJELLEMZOID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_TANTERVIJELLEMZOTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_BankszamlaTulajdonosTipusID_AlintezmenyId_AltanevId_REF_BankszamlaTulajdonosTipus 
  FOREIGN KEY (C_BANKSZAMLATULAJDONOSTIPUSID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_BANKSZAMLATULAJDONOSTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_JogviszonyTipusID_AlintezmenyId_AltanevId_REF_JogviszonyTipus 
  FOREIGN KEY (C_JOGVISZONYTIPUSID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_JOGVISZONYTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_AgazatUjSzktTipusId_AlintezmenyId_AltanevId_REF_AgazatUjSzktTipus 
  FOREIGN KEY (C_AGAZATUJSZKTTIPUSID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_AGAZATUJSZKTTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_SzakmairanyTipusId_AlintezmenyId_AltanevId_REF_SzakmairanyTipus 
  FOREIGN KEY (C_SZAKMAIRANYTIPUSID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_SZAKMAIRANYTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_SzakmaTipusId_AlintezmenyId_AltanevId_REF_SzakmaTipus 
  FOREIGN KEY (C_SZAKMATIPUSID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_SZAKMATIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_SzakiranyNktTipusId_AlintezmenyId_AltanevId_REF_SzakiranyNktTipus 
  FOREIGN KEY (C_SZAKIRANYNKTTIPUSID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_SZAKIRANYNKTTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_SzakkepesitesNktTipusId_AlintezmenyId_AltanevId_REF_SzakkepesitesNktTipus 
  FOREIGN KEY (C_SZAKKEPESITESNKTTIPUSID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_SZAKKEPESITESNKTTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_TanulmanyiTeruletNktTipusId_AlintezmenyId_AltanevId_REF_TanulmanyiTeruletNktTipus 
  FOREIGN KEY (C_TANULMANYITERULETNKTTIPUSID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_TANULMANYITERULETNKTTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_TartozkodasJogcimTipusId_AlintezmenyId_AltanevId_REF_TartozkodasJogcimTipus 
  FOREIGN KEY (C_TARTOZKODASJOGCIMTIPUSID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_TARTOZKODASJOGCIMTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_MufajTipusId_AlintezmenyId_AltanevId_REF_MufajTipus 
  FOREIGN KEY (C_MUFAJTIPUSID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_MUFAJTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_MuveszetiAgId_AlintezmenyId_AltanevId_REF_MuveszetiAg 
  FOREIGN KEY (C_MUVESZETIAGID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_MUVESZETIAG (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_TanszakTipusId_AlintezmenyId_AltanevId_REF_TanszakTipus 
  FOREIGN KEY (C_TANSZAKTIPUSID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_TANSZAKTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_TartJogOkmanyTipusId_AlintezmenyId_AltanevId_REF_TartJogOkmanyTipus 
  FOREIGN KEY (C_TARTJOGOKMANYTIPUSID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_TARTJOGOKMANYTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_GONDVISELO 
  ADD CONSTRAINT FK_Gondviselo_RokonsagFoka_IntezmenyId_TanevId_REF_RokonsagiFok 
  FOREIGN KEY (C_ROKONSAGFOKA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ROKONSAGIFOK (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_MUNKAKORTIPUS 
  ADD CONSTRAINT FK_MunkakorTipus_AlkalmazottMunkaKorTipusId_AlintezmenyId_AltanevId_REF_AlkalmazottMunkaKorTipus 
  FOREIGN KEY (C_ALKALMAZOTTMUNKAKORTIPUSID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_ALKALMAZOTTMUNKAKORTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_MUKODESIHELY 
  ADD CONSTRAINT FK_MukodesiHely_MukodesiHelyTipusa_IntezmenyId_TanevId_REF_MukodesiHelyTipus 
  FOREIGN KEY (C_MUKODESIHELYTIPUSA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_MUKODESIHELYTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ALKALMAZOTT 
  ADD CONSTRAINT FK_Alkalmazott_KKKepesitesId_AlintezmenyId_AltanevId_REF_KKKepesitesTipus 
  FOREIGN KEY (C_KKKEPESITESID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_KKKEPESITESTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ALKALMAZOTT 
  ADD CONSTRAINT FK_Alkalmazott_BankszamlaTulajdonosTipus_AlintezmenyId_AltanevId_REF_BankszamlaTulajdonosTipus 
  FOREIGN KEY (C_BANKSZAMLATULAJDONOSTIPUS, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [dbo].T_BANKSZAMLATULAJDONOSTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TEREM 
  ADD CONSTRAINT FK_Terem_Jelleg_IntezmenyId_TanevId_REF_TeremTipus 
  FOREIGN KEY (C_JELLEG, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_TEREMTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TEREM 
  ADD CONSTRAINT FK_Terem_TulajdonTipusId_IntezmenyId_TanevId_REF_TulajdonTipus 
  FOREIGN KEY (C_TULAJDONTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_TULAJDONTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TEREM 
  ADD CONSTRAINT FK_Terem_DualisHelyszinTipusId_IntezmenyId_TanevId_REF_DualisHelyszinTipus 
  FOREIGN KEY (C_DUALISHELYSZINTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_DUALISHELYSZINTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ESZKOZ 
  ADD CONSTRAINT FK_Eszkoz_Kategoria_IntezmenyId_TanevId_REF_EszkozKategoria 
  FOREIGN KEY (C_KATEGORIA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ESZKOZKATEGORIA (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ESZKOZ 
  ADD CONSTRAINT FK_Eszkoz_Tipus_IntezmenyId_TanevId_REF_EszkozTipus 
  FOREIGN KEY (C_TIPUS, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ESZKOZTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ESZKOZ 
  ADD CONSTRAINT FK_Eszkoz_Celja_IntezmenyId_TanevId_REF_EszkozCel 
  FOREIGN KEY (C_CELJA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ESZKOZCEL (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ESZKOZ 
  ADD CONSTRAINT FK_Eszkoz_Jellege_IntezmenyId_TanevId_REF_EszkozJelleg 
  FOREIGN KEY (C_JELLEGE, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ESZKOZJELLEG (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_ESZKOZ 
  ADD CONSTRAINT FK_Eszkoz_MennyisegiEgyseg_IntezmenyId_TanevId_REF_MertekegysegTipus 
  FOREIGN KEY (C_MENNYISEGIEGYSEG, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_MERTEKEGYSEGTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TELEFON 
  ADD CONSTRAINT FK_Telefon_TelefonTipusa_IntezmenyId_TanevId_REF_TelefonTipus 
  FOREIGN KEY (C_TELEFONTIPUSA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_TELEFONTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_SZEREPKOR 
  ADD CONSTRAINT FK_Szerepkor_SzerepkorTipus_IntezmenyId_TanevId_REF_SzerepkorTipus 
  FOREIGN KEY (C_SZEREPKORTIPUS, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_SZEREPKORTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_CIM 
  ADD CONSTRAINT FK_Cim_CimTipusa_IntezmenyId_TanevId_REF_CimTipus 
  FOREIGN KEY (C_CIMTIPUSA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_CIMTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_CIM 
  ADD CONSTRAINT FK_Cim_Orszag_IntezmenyId_TanevId_REF_OrszagTipus 
  FOREIGN KEY (C_ORSZAG, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ORSZAGTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_EMAIL 
  ADD CONSTRAINT FK_Email_EmailTipusa_IntezmenyId_TanevId_REF_EmailTipus 
  FOREIGN KEY (C_EMAILTIPUSA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_EMAILTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_FELHASZNALO 
  ADD CONSTRAINT FK_Felhasznalo_Neme_IntezmenyId_TanevId_REF_Nem 
  FOREIGN KEY (C_NEME, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_NEM (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_FELHASZNALO 
  ADD CONSTRAINT FK_Felhasznalo_Allampolgarsaga_IntezmenyId_TanevId_REF_Allampolgarsag 
  FOREIGN KEY (C_ALLAMPOLGARSAGA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ALLAMPOLGARSAG (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_FELHASZNALO 
  ADD CONSTRAINT FK_Felhasznalo_SzuletesiOrszag_IntezmenyId_TanevId_REF_OrszagTipus 
  FOREIGN KEY (C_SZULETESIORSZAG, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ORSZAGTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_FELHASZNALO 
  ADD CONSTRAINT FK_Felhasznalo_Anyanyelve_IntezmenyId_TanevId_REF_Anyanyelv 
  FOREIGN KEY (C_ANYANYELVE, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ANYANYELV (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_FELHASZNALO 
  ADD CONSTRAINT FK_Felhasznalo_IgazolvanyTipusa_IntezmenyId_TanevId_REF_IgazolvanyTipus 
  FOREIGN KEY (C_IGAZOLVANYTIPUSA, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_IGAZOLVANYTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_FELHASZNALO 
  ADD CONSTRAINT FK_Felhasznalo_Allampolgarsaga2_IntezmenyId_TanevId_REF_Allampolgarsag 
  FOREIGN KEY (C_ALLAMPOLGARSAGA2, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [dbo].T_ALLAMPOLGARSAG (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO
--/*Entitások egyébb FK*/

ALTER TABLE [DBO].T_TANULASIEGYSEG 
  ADD CONSTRAINT FK_TanulasiEgyseg_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANULASIEGYSEG 
  ADD CONSTRAINT FK_TanulasiEgyseg_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_NYUGDIJTIPUS 
  ADD CONSTRAINT FK_NyugdijTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_NYUGDIJTIPUS 
  ADD CONSTRAINT FK_NyugdijTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_NYUGDIJTIPUS 
  ADD CONSTRAINT FK_NyugdijTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_SZAKMUNKASZERZODES 
  ADD CONSTRAINT FK_SzakmunkaSzerzodes_SzervezetId_REF_Szervezet 
  FOREIGN KEY (C_SZERVEZETID) 
  REFERENCES [DBO].T_SZERVEZET (ID)
GO

ALTER TABLE [DBO].T_SZAKMUNKASZERZODES 
  ADD CONSTRAINT FK_SzakmunkaSzerzodes_TanuloTanugyiAdatokId_REF_TanuloTanugyiAdatok 
  FOREIGN KEY (C_TANULOTANUGYIADATOKID) 
  REFERENCES [DBO].T_TANULOTANUGYIADATOK (ID)
GO

ALTER TABLE [DBO].T_SZAKMUNKASZERZODES 
  ADD CONSTRAINT FK_SzakmunkaSzerzodes_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_SZAKMUNKASZERZODES 
  ADD CONSTRAINT FK_SzakmunkaSzerzodes_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_APACZAIKGRJOGOSULT 
  ADD CONSTRAINT FK_ApaczaiKgrJogosult_TanuloId_REF_Tanulo 
  FOREIGN KEY (C_TANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_APACZAIKGRJOGOSULT 
  ADD CONSTRAINT FK_ApaczaiKgrJogosult_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_APACZAIKGRJOGOSULT 
  ADD CONSTRAINT FK_ApaczaiKgrJogosult_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_SZIRSTATNEMALLAMIOKTKOLTS 
  ADD CONSTRAINT FK_SzirStatNemAllamiOktKolts_FeladatEllatasiHelyId_REF_FeladatEllatasiHely 
  FOREIGN KEY (C_FELADATELLATASIHELYID) 
  REFERENCES [DBO].T_FELADATELLATASIHELY (ID)
GO

ALTER TABLE [DBO].T_SZIRSTATNEMALLAMIOKTKOLTS 
  ADD CONSTRAINT FK_SzirStatNemAllamiOktKolts_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_SZIRSTATNEMALLAMIOKTKOLTS 
  ADD CONSTRAINT FK_SzirStatNemAllamiOktKolts_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_DUALISHELYSZINTIPUS 
  ADD CONSTRAINT FK_DualisHelyszinTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_DUALISHELYSZINTIPUS 
  ADD CONSTRAINT FK_DualisHelyszinTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_DUALISHELYSZINTIPUS 
  ADD CONSTRAINT FK_DualisHelyszinTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_UJSZKTRESZSZAKMAOSSZERENDELE 
  ADD CONSTRAINT FK_UjSzktReszszakmaOsszerendeles_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_UJSZKTRESZSZAKMAOSSZERENDELE 
  ADD CONSTRAINT FK_UjSzktReszszakmaOsszerendeles_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_REGISZKTOSSZERENDELES 
  ADD CONSTRAINT FK_RegiSzktOsszerendeles_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_REGISZKTOSSZERENDELES 
  ADD CONSTRAINT FK_RegiSzktOsszerendeles_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_NKTOSSZERENDELES 
  ADD CONSTRAINT FK_NktOsszerendeles_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_NKTOSSZERENDELES 
  ADD CONSTRAINT FK_NktOsszerendeles_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_UJSZKTSZAKMAJEGYZEKOSSZEREND 
  ADD CONSTRAINT FK_UjSzktSzakmajegyzekOsszerendeles_FileId_REF_File 
  FOREIGN KEY (C_FILEID) 
  REFERENCES [DBO].T_FILE (ID)
GO

ALTER TABLE [DBO].T_UJSZKTSZAKMAJEGYZEKOSSZEREND 
  ADD CONSTRAINT FK_UjSzktSzakmajegyzekOsszerendeles_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_UJSZKTSZAKMAJEGYZEKOSSZEREND 
  ADD CONSTRAINT FK_UjSzktSzakmajegyzekOsszerendeles_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_SZERVEZET 
  ADD CONSTRAINT FK_Szervezet_ParentSzervezetId_REF_Szervezet 
  FOREIGN KEY (C_PARENTSZERVEZETID) 
  REFERENCES [DBO].T_SZERVEZET (ID)
GO

ALTER TABLE [DBO].T_SZERVEZET 
  ADD CONSTRAINT FK_Szervezet_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_SZERVEZET 
  ADD CONSTRAINT FK_Szervezet_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ERTEKELESTANTARGYINYELV 
  ADD CONSTRAINT FK_ErtekelesTantargyiNyelv_ErtekelesTantargyiId_REF_ErtekelesTantargyi 
  FOREIGN KEY (C_ERTEKELESTANTARGYIID) 
  REFERENCES [DBO].T_ERTEKELESTANTARGYI (ID)
GO

ALTER TABLE [DBO].T_ERTEKELESTANTARGYINYELV 
  ADD CONSTRAINT FK_ErtekelesTantargyiNyelv_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ERTEKELESTANTARGYINYELV 
  ADD CONSTRAINT FK_ErtekelesTantargyiNyelv_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ERTEKELESMAGSZOR 
  ADD CONSTRAINT FK_ErtekelesMagSzor_TanuloId_REF_Tanulo 
  FOREIGN KEY (C_TANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_ERTEKELESMAGSZOR 
  ADD CONSTRAINT FK_ErtekelesMagSzor_RogzitoAlkalmazottId_REF_Alkalmazott 
  FOREIGN KEY (C_ROGZITOALKALMAZOTTID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_ERTEKELESMAGSZOR 
  ADD CONSTRAINT FK_ErtekelesMagSzor_RogziteskoriOsztalyId_REF_OsztalyCsoport 
  FOREIGN KEY (C_ROGZITESKORIOSZTALYID) 
  REFERENCES [DBO].T_OSZTALYCSOPORT (ID)
GO

ALTER TABLE [DBO].T_ERTEKELESMAGSZOR 
  ADD CONSTRAINT FK_ErtekelesMagSzor_OsztalyCsoportId_REF_OsztalyCsoport 
  FOREIGN KEY (C_OSZTALYCSOPORTID) 
  REFERENCES [DBO].T_OSZTALYCSOPORT (ID)
GO

ALTER TABLE [DBO].T_ERTEKELESMAGSZOR 
  ADD CONSTRAINT FK_ErtekelesMagSzor_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ERTEKELESMAGSZOR 
  ADD CONSTRAINT FK_ErtekelesMagSzor_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ERTEKELESMAGSZORNYELV 
  ADD CONSTRAINT FK_ErtekelesMagSzorNyelv_ErtekelesMagSzorId_REF_ErtekelesMagSzor 
  FOREIGN KEY (C_ERTEKELESMAGSZORID) 
  REFERENCES [DBO].T_ERTEKELESMAGSZOR (ID)
GO

ALTER TABLE [DBO].T_ERTEKELESMAGSZORNYELV 
  ADD CONSTRAINT FK_ErtekelesMagSzorNyelv_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ERTEKELESMAGSZORNYELV 
  ADD CONSTRAINT FK_ErtekelesMagSzorNyelv_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ERTEKELESTANTARGYI 
  ADD CONSTRAINT FK_ErtekelesTantargyi_TantargyId_REF_Tantargy 
  FOREIGN KEY (C_TANTARGYID) 
  REFERENCES [DBO].T_TANTARGY (ID)
GO

ALTER TABLE [DBO].T_ERTEKELESTANTARGYI 
  ADD CONSTRAINT FK_ErtekelesTantargyi_RogziteskoriOsztalyId_REF_OsztalyCsoport 
  FOREIGN KEY (C_ROGZITESKORIOSZTALYID) 
  REFERENCES [DBO].T_OSZTALYCSOPORT (ID)
GO

ALTER TABLE [DBO].T_ERTEKELESTANTARGYI 
  ADD CONSTRAINT FK_ErtekelesTantargyi_TanuloId_REF_Tanulo 
  FOREIGN KEY (C_TANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_ERTEKELESTANTARGYI 
  ADD CONSTRAINT FK_ErtekelesTantargyi_OsszefuggoSzakGyakId_REF_OsszefuggoSzakGyak 
  FOREIGN KEY (C_OSSZEFUGGOSZAKGYAKID) 
  REFERENCES [DBO].T_OSSZEFUGGOSZAKGYAK (ID)
GO

ALTER TABLE [DBO].T_ERTEKELESTANTARGYI 
  ADD CONSTRAINT FK_ErtekelesTantargyi_RogzitoAlkalmazottId_REF_Alkalmazott 
  FOREIGN KEY (C_ROGZITOALKALMAZOTTID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_ERTEKELESTANTARGYI 
  ADD CONSTRAINT FK_ErtekelesTantargyi_OsztalyCsoportId_REF_OsztalyCsoport 
  FOREIGN KEY (C_OSZTALYCSOPORTID) 
  REFERENCES [DBO].T_OSZTALYCSOPORT (ID)
GO

ALTER TABLE [DBO].T_ERTEKELESTANTARGYI 
  ADD CONSTRAINT FK_ErtekelesTantargyi_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ERTEKELESTANTARGYI 
  ADD CONSTRAINT FK_ErtekelesTantargyi_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_AGAZATALAPVIZSGAEREDTIPUS 
  ADD CONSTRAINT FK_AgazatAlapVizsgaEredTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_AGAZATALAPVIZSGAEREDTIPUS 
  ADD CONSTRAINT FK_AgazatAlapVizsgaEredTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_AGAZATALAPVIZSGAEREDTIPUS 
  ADD CONSTRAINT FK_AgazatAlapVizsgaEredTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_JOGVKELETKEZESEJOGCIMTIPUS 
  ADD CONSTRAINT FK_JogvKeletkezeseJogcimTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_JOGVKELETKEZESEJOGCIMTIPUS 
  ADD CONSTRAINT FK_JogvKeletkezeseJogcimTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_JOGVKELETKEZESEJOGCIMTIPUS 
  ADD CONSTRAINT FK_JogvKeletkezeseJogcimTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_AGAZATALAPOKTMEGNEVTIPUS 
  ADD CONSTRAINT FK_AgazatAlapOktMegnevTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_AGAZATALAPOKTMEGNEVTIPUS 
  ADD CONSTRAINT FK_AgazatAlapOktMegnevTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_AGAZATALAPOKTMEGNEVTIPUS 
  ADD CONSTRAINT FK_AgazatAlapOktMegnevTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TBJOGVISZONY 
  ADD CONSTRAINT FK_TbJogviszony_TanuloId_REF_Tanulo 
  FOREIGN KEY (C_TANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_TBJOGVISZONY 
  ADD CONSTRAINT FK_TbJogviszony_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TBJOGVISZONY 
  ADD CONSTRAINT FK_TbJogviszony_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_TBJOGVISZONYTIPUS 
  ADD CONSTRAINT FK_TbJogviszonyTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_TBJOGVISZONYTIPUS 
  ADD CONSTRAINT FK_TbJogviszonyTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TBJOGVISZONYTIPUS 
  ADD CONSTRAINT FK_TbJogviszonyTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_JOGVMEGSZUNESEJOGCIMTIPUS 
  ADD CONSTRAINT FK_JogvMegszuneseJogcimTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_JOGVMEGSZUNESEJOGCIMTIPUS 
  ADD CONSTRAINT FK_JogvMegszuneseJogcimTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_JOGVMEGSZUNESEJOGCIMTIPUS 
  ADD CONSTRAINT FK_JogvMegszuneseJogcimTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ESZKOZIGENYLESSTATUSZ 
  ADD CONSTRAINT FK_EszkozIgenylesStatusz_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ESZKOZIGENYLESSTATUSZ 
  ADD CONSTRAINT FK_EszkozIgenylesStatusz_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ESZKOZIGENYLESSTATUSZ 
  ADD CONSTRAINT FK_EszkozIgenylesStatusz_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_MUNKASZERZODES 
  ADD CONSTRAINT FK_MunkaSzerzodes_AlkalmazottId_REF_Alkalmazott 
  FOREIGN KEY (C_ALKALMAZOTTID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_MUNKASZERZODES 
  ADD CONSTRAINT FK_MunkaSzerzodes_TanuloTanugyiAdatokId_REF_TanuloTanugyiAdatok 
  FOREIGN KEY (C_TANULOTANUGYIADATOKID) 
  REFERENCES [DBO].T_TANULOTANUGYIADATOK (ID)
GO

ALTER TABLE [DBO].T_MUNKASZERZODES 
  ADD CONSTRAINT FK_MunkaSzerzodes_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_MUNKASZERZODES 
  ADD CONSTRAINT FK_MunkaSzerzodes_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_RESZSZAKMATIPUS 
  ADD CONSTRAINT FK_ReszSzakmaTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_RESZSZAKMATIPUS 
  ADD CONSTRAINT FK_ReszSzakmaTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_RESZSZAKMATIPUS 
  ADD CONSTRAINT FK_ReszSzakmaTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_AGAZATRESZSZAKMATIPUS 
  ADD CONSTRAINT FK_AgazatReszSzakmaTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_AGAZATRESZSZAKMATIPUS 
  ADD CONSTRAINT FK_AgazatReszSzakmaTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_AGAZATRESZSZAKMATIPUS 
  ADD CONSTRAINT FK_AgazatReszSzakmaTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_SZAKMARESZSZAKMATIPUS 
  ADD CONSTRAINT FK_SzakmaReszSzakmaTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_SZAKMARESZSZAKMATIPUS 
  ADD CONSTRAINT FK_SzakmaReszSzakmaTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_SZAKMARESZSZAKMATIPUS 
  ADD CONSTRAINT FK_SzakmaReszSzakmaTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ESZKOZIGENYLES 
  ADD CONSTRAINT FK_EszkozIgenyles_GondviseloId_REF_Gondviselo 
  FOREIGN KEY (C_GONDVISELOID) 
  REFERENCES [DBO].T_GONDVISELO (ID)
GO

ALTER TABLE [DBO].T_ESZKOZIGENYLES 
  ADD CONSTRAINT FK_EszkozIgenyles_TanuloId_REF_Tanulo 
  FOREIGN KEY (C_TANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_ESZKOZIGENYLES 
  ADD CONSTRAINT FK_EszkozIgenyles_AlkalmazottId_REF_Alkalmazott 
  FOREIGN KEY (C_ALKALMAZOTTID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_ESZKOZIGENYLES 
  ADD CONSTRAINT FK_EszkozIgenyles_FeladatEllatasiHelyId_REF_FeladatEllatasiHely 
  FOREIGN KEY (C_FELADATELLATASIHELYID) 
  REFERENCES [DBO].T_FELADATELLATASIHELY (ID)
GO

ALTER TABLE [DBO].T_ESZKOZIGENYLES 
  ADD CONSTRAINT FK_EszkozIgenyles_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ESZKOZIGENYLES 
  ADD CONSTRAINT FK_EszkozIgenyles_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_SZIRSTATKONYVTARKATEGORIA 
  ADD CONSTRAINT FK_SzirStatKonyvtarKategoria_FoKategoriaId_REF_SzirStatKonyvtarKategoria 
  FOREIGN KEY (C_FOKATEGORIAID) 
  REFERENCES [DBO].T_SZIRSTATKONYVTARKATEGORIA (ID)
GO

ALTER TABLE [DBO].T_SZIRSTATKONYVTAR 
  ADD CONSTRAINT FK_SzirStatKonyvtar_SzirStatKonyvtarKategoriaId_REF_SzirStatKonyvtarKategoria 
  FOREIGN KEY (C_SZIRSTATKONYVTARKATEGORIAID) 
  REFERENCES [DBO].T_SZIRSTATKONYVTARKATEGORIA (ID)
GO

ALTER TABLE [DBO].T_SZIRSTATKONYVTAR 
  ADD CONSTRAINT FK_SzirStatKonyvtar_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_SZIRSTATKONYVTAR 
  ADD CONSTRAINT FK_SzirStatKonyvtar_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_OGORAREND 
  ADD CONSTRAINT FK_OgOrarend_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_OGORAREND 
  ADD CONSTRAINT FK_OgOrarend_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_FOGYATEKOSSAGTIPUS 
  ADD CONSTRAINT FK_FogyatekossagTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_FOGYATEKOSSAGTIPUS 
  ADD CONSTRAINT FK_FogyatekossagTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_FOGYATEKOSSAGTIPUS 
  ADD CONSTRAINT FK_FogyatekossagTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_SZIRSTATFELADATELLATASIHELY 
  ADD CONSTRAINT FK_SzirStatFeladatellatasiHely_FeladatEllatasiHelyId_REF_FeladatEllatasiHely 
  FOREIGN KEY (C_FELADATELLATASIHELYID) 
  REFERENCES [DBO].T_FELADATELLATASIHELY (ID)
GO

ALTER TABLE [DBO].T_SZIRSTATFELADATELLATASIHELY 
  ADD CONSTRAINT FK_SzirStatFeladatellatasiHely_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_SZIRSTATFELADATELLATASIHELY 
  ADD CONSTRAINT FK_SzirStatFeladatellatasiHely_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_SZIRSTATTANULO 
  ADD CONSTRAINT FK_SzirStatTanulo_TanuloId_REF_Tanulo 
  FOREIGN KEY (C_TANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_SZIRSTATTANULO 
  ADD CONSTRAINT FK_SzirStatTanulo_FeladatEllatasiHelyId_REF_FeladatEllatasiHely 
  FOREIGN KEY (C_FELADATELLATASIHELYID) 
  REFERENCES [DBO].T_FELADATELLATASIHELY (ID)
GO

ALTER TABLE [DBO].T_SZIRSTATTANULO 
  ADD CONSTRAINT FK_SzirStatTanulo_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_SZIRSTATTANULO 
  ADD CONSTRAINT FK_SzirStatTanulo_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_KEPESITESTIPUS 
  ADD CONSTRAINT FK_KepesitesTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_KEPESITESTIPUS 
  ADD CONSTRAINT FK_KepesitesTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KEPESITESTIPUS 
  ADD CONSTRAINT FK_KepesitesTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_TARTJOGOKMANYTIPUS 
  ADD CONSTRAINT FK_TartJogOkmanyTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_TARTJOGOKMANYTIPUS 
  ADD CONSTRAINT FK_TartJogOkmanyTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TARTJOGOKMANYTIPUS 
  ADD CONSTRAINT FK_TartJogOkmanyTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_TARTOZKODASJOGCIMTIPUS 
  ADD CONSTRAINT FK_TartozkodasJogcimTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_TARTOZKODASJOGCIMTIPUS 
  ADD CONSTRAINT FK_TartozkodasJogcimTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TARTOZKODASJOGCIMTIPUS 
  ADD CONSTRAINT FK_TartozkodasJogcimTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_TKJOGALAPTIPUS 
  ADD CONSTRAINT FK_TKJogalapTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_TKJOGALAPTIPUS 
  ADD CONSTRAINT FK_TKJogalapTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TKJOGALAPTIPUS 
  ADD CONSTRAINT FK_TKJogalapTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_FELEKEZETTIPUS 
  ADD CONSTRAINT FK_FelekezetTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_FELEKEZETTIPUS 
  ADD CONSTRAINT FK_FelekezetTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_FELEKEZETTIPUS 
  ADD CONSTRAINT FK_FelekezetTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_NEMZETISEGTIPUS 
  ADD CONSTRAINT FK_NemzetisegTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_NEMZETISEGTIPUS 
  ADD CONSTRAINT FK_NemzetisegTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_NEMZETISEGTIPUS 
  ADD CONSTRAINT FK_NemzetisegTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_TANSZAKTIPUS 
  ADD CONSTRAINT FK_TanszakTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_TANSZAKTIPUS 
  ADD CONSTRAINT FK_TanszakTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANSZAKTIPUS 
  ADD CONSTRAINT FK_TanszakTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_MUFAJTIPUS 
  ADD CONSTRAINT FK_MufajTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_MUFAJTIPUS 
  ADD CONSTRAINT FK_MufajTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_MUFAJTIPUS 
  ADD CONSTRAINT FK_MufajTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_DUALISSZERZODESFILE 
  ADD CONSTRAINT FK_DualisSzerzodesFile_FileId_REF_File 
  FOREIGN KEY (C_FILEID) 
  REFERENCES [DBO].T_FILE (ID)
GO

ALTER TABLE [DBO].T_DUALISSZERZODESFILE 
  ADD CONSTRAINT FK_DualisSzerzodesFile_TanuloId_REF_Tanulo 
  FOREIGN KEY (C_TANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_DUALISSZERZODESFILE 
  ADD CONSTRAINT FK_DualisSzerzodesFile_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_DUALISSZERZODESFILE 
  ADD CONSTRAINT FK_DualisSzerzodesFile_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_EPJTANULOIADAT 
  ADD CONSTRAINT FK_EpjTanuloiAdat_TanuloId_REF_Tanulo 
  FOREIGN KEY (C_TANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_EPJTANULOIADAT 
  ADD CONSTRAINT FK_EpjTanuloiAdat_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_EPJTANULOIADAT 
  ADD CONSTRAINT FK_EpjTanuloiAdat_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_INTEZMENYCONFIG 
  ADD CONSTRAINT FK_IntezmenyConfig_ConfigTipusId_REF_ConfigTipus 
  FOREIGN KEY (C_CONFIGTIPUSID) 
  REFERENCES [DBO].T_CONFIGTIPUS (ID)
GO

ALTER TABLE [DBO].T_INTEZMENYCONFIG 
  ADD CONSTRAINT FK_IntezmenyConfig_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_IKTATOTTDOKUMENTUMCSATOLMANY 
  ADD CONSTRAINT FK_IktatottDokumentumCsatolmany_IktatottDokumentumId_REF_IktatottDokumentum 
  FOREIGN KEY (C_IKTATOTTDOKUMENTUMID) 
  REFERENCES [DBO].T_IKTATOTTDOKUMENTUM (ID)
GO

ALTER TABLE [DBO].T_IKTATOTTDOKUMENTUMCSATOLMANY 
  ADD CONSTRAINT FK_IktatottDokumentumCsatolmany_FileId_REF_File 
  FOREIGN KEY (C_FILEID) 
  REFERENCES [DBO].T_FILE (ID)
GO

ALTER TABLE [DBO].T_IKTATOTTDOKUMENTUMCSATOLMANY 
  ADD CONSTRAINT FK_IktatottDokumentumCsatolmany_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_IKTATOTTDOKUMENTUMCSATOLMANY 
  ADD CONSTRAINT FK_IktatottDokumentumCsatolmany_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANITASIORADIGTAMESZKOZ 
  ADD CONSTRAINT FK_TanitasiOraDigTamEszkoz_TanitasiOraId_REF_TanitasiOra 
  FOREIGN KEY (C_TANITASIORAID) 
  REFERENCES [DBO].T_TANITASIORA (ID)
GO

ALTER TABLE [DBO].T_TANITASIORADIGTAMESZKOZ 
  ADD CONSTRAINT FK_TanitasiOraDigTamEszkoz_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANITASIORADIGTAMESZKOZ 
  ADD CONSTRAINT FK_TanitasiOraDigTamEszkoz_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_DIGTAMESZKOZTIPUS 
  ADD CONSTRAINT FK_DigTamEszkozTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_DIGTAMESZKOZTIPUS 
  ADD CONSTRAINT FK_DigTamEszkozTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_DIGTAMESZKOZTIPUS 
  ADD CONSTRAINT FK_DigTamEszkozTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_DIGPLATFORMTIPUS 
  ADD CONSTRAINT FK_DigPlatformTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_DIGPLATFORMTIPUS 
  ADD CONSTRAINT FK_DigPlatformTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_DIGPLATFORMTIPUS 
  ADD CONSTRAINT FK_DigPlatformTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_DIGESZKOZTIPUS 
  ADD CONSTRAINT FK_DigEszkozTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_DIGESZKOZTIPUS 
  ADD CONSTRAINT FK_DigEszkozTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_DIGESZKOZTIPUS 
  ADD CONSTRAINT FK_DigEszkozTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_SZAKKEPESITESNKTTIPUS 
  ADD CONSTRAINT FK_SzakkepesitesNktTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_SZAKKEPESITESNKTTIPUS 
  ADD CONSTRAINT FK_SzakkepesitesNktTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_SZAKKEPESITESNKTTIPUS 
  ADD CONSTRAINT FK_SzakkepesitesNktTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_TANULMANYITERULETNKTTIPUS 
  ADD CONSTRAINT FK_TanulmanyiTeruletNktTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_TANULMANYITERULETNKTTIPUS 
  ADD CONSTRAINT FK_TanulmanyiTeruletNktTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANULMANYITERULETNKTTIPUS 
  ADD CONSTRAINT FK_TanulmanyiTeruletNktTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_TULAJDONTIPUS 
  ADD CONSTRAINT FK_TulajdonTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_TULAJDONTIPUS 
  ADD CONSTRAINT FK_TulajdonTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TULAJDONTIPUS 
  ADD CONSTRAINT FK_TulajdonTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_SZAKIRANYNKTTIPUS 
  ADD CONSTRAINT FK_SzakiranyNktTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_SZAKIRANYNKTTIPUS 
  ADD CONSTRAINT FK_SzakiranyNktTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_SZAKIRANYNKTTIPUS 
  ADD CONSTRAINT FK_SzakiranyNktTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_PROFILKEPFILE 
  ADD CONSTRAINT FK_ProfilkepFile_GondviseloId_REF_Gondviselo 
  FOREIGN KEY (C_GONDVISELOID) 
  REFERENCES [DBO].T_GONDVISELO (ID)
GO

ALTER TABLE [DBO].T_PROFILKEPFILE 
  ADD CONSTRAINT FK_ProfilkepFile_FelhasznaloId_REF_Felhasznalo 
  FOREIGN KEY (C_FELHASZNALOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_PROFILKEPFILE 
  ADD CONSTRAINT FK_ProfilkepFile_FileId_REF_File 
  FOREIGN KEY (C_FILEID) 
  REFERENCES [DBO].T_FILE (ID)
GO

ALTER TABLE [DBO].T_PROFILKEPFILE 
  ADD CONSTRAINT FK_ProfilkepFile_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_PROFILKEPFILE 
  ADD CONSTRAINT FK_ProfilkepFile_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ZARADEK 
  ADD CONSTRAINT FK_Zaradek_RogzitoId_REF_Felhasznalo 
  FOREIGN KEY (C_ROGZITOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_ZARADEK 
  ADD CONSTRAINT FK_Zaradek_UtolsoModositoId_REF_Felhasznalo 
  FOREIGN KEY (C_UTOLSOMODOSITOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_ZARADEK 
  ADD CONSTRAINT FK_Zaradek_TanuloCsoportId_REF_TanuloCsoport 
  FOREIGN KEY (C_TANULOCSOPORTID) 
  REFERENCES [DBO].T_TANULOCSOPORT (ID)
GO

ALTER TABLE [DBO].T_ZARADEK 
  ADD CONSTRAINT FK_Zaradek_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ZARADEK 
  ADD CONSTRAINT FK_Zaradek_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ORAFILETIPUS 
  ADD CONSTRAINT FK_OraFileTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ORAFILETIPUS 
  ADD CONSTRAINT FK_OraFileTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ORAFILETIPUS 
  ADD CONSTRAINT FK_OraFileTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ZARADEKNYELV 
  ADD CONSTRAINT FK_ZaradekNyelv_ZaradekId_REF_Zaradek 
  FOREIGN KEY (C_ZARADEKID) 
  REFERENCES [DBO].T_ZARADEK (ID)
GO

ALTER TABLE [DBO].T_ZARADEKNYELV 
  ADD CONSTRAINT FK_ZaradekNyelv_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ZARADEKNYELV 
  ADD CONSTRAINT FK_ZaradekNyelv_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ORAFILE 
  ADD CONSTRAINT FK_OraFile_OrarendiOraId_REF_OrarendiOra 
  FOREIGN KEY (C_ORARENDIORAID) 
  REFERENCES [DBO].T_ORARENDIORA (ID)
GO

ALTER TABLE [DBO].T_ORAFILE 
  ADD CONSTRAINT FK_OraFile_TanitasiOraId_REF_TanitasiOra 
  FOREIGN KEY (C_TANITASIORAID) 
  REFERENCES [DBO].T_TANITASIORA (ID)
GO

ALTER TABLE [DBO].T_ORAFILE 
  ADD CONSTRAINT FK_OraFile_TantargyId_REF_Tantargy 
  FOREIGN KEY (C_TANTARGYID) 
  REFERENCES [DBO].T_TANTARGY (ID)
GO

ALTER TABLE [DBO].T_ORAFILE 
  ADD CONSTRAINT FK_OraFile_DKT_FileId_REF_DKT_File 
  FOREIGN KEY (C_DKT_FILEID) 
  REFERENCES [DBO].T_DKT_FILE (ID)
GO

ALTER TABLE [DBO].T_ORAFILE 
  ADD CONSTRAINT FK_OraFile_AlkalmazottId_REF_Alkalmazott 
  FOREIGN KEY (C_ALKALMAZOTTID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_ORAFILE 
  ADD CONSTRAINT FK_OraFile_OsztalyCsoportId_REF_OsztalyCsoport 
  FOREIGN KEY (C_OSZTALYCSOPORTID) 
  REFERENCES [DBO].T_OSZTALYCSOPORT (ID)
GO

ALTER TABLE [DBO].T_ORAFILE 
  ADD CONSTRAINT FK_OraFile_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ORAFILE 
  ADD CONSTRAINT FK_OraFile_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_SZIRSTATTIPUS 
  ADD CONSTRAINT FK_SzirStatTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_SZIRSTATTIPUS 
  ADD CONSTRAINT FK_SzirStatTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_SZIRSTATTIPUS 
  ADD CONSTRAINT FK_SzirStatTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_KIRSZIRFELADATELLATASIHELY 
  ADD CONSTRAINT FK_KirSzirFeladatellatasiHely_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KIRSZIRFELADATELLATASIHELY 
  ADD CONSTRAINT FK_KirSzirFeladatellatasiHely_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_FILE 
  ADD CONSTRAINT FK_File_FelhasznaloId_REF_Felhasznalo 
  FOREIGN KEY (C_FELHASZNALOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_FILE 
  ADD CONSTRAINT FK_File_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_FILE 
  ADD CONSTRAINT FK_File_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_JOGVISZONYSZUNETELTETES 
  ADD CONSTRAINT FK_JogviszonySzuneteltetes_TanuloId_REF_Tanulo 
  FOREIGN KEY (C_TANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_JOGVISZONYSZUNETELTETES 
  ADD CONSTRAINT FK_JogviszonySzuneteltetes_TanuloTanugyiAdatokId_REF_TanuloTanugyiAdatok 
  FOREIGN KEY (C_TANULOTANUGYIADATOKID) 
  REFERENCES [DBO].T_TANULOTANUGYIADATOK (ID)
GO

ALTER TABLE [DBO].T_JOGVISZONYSZUNETELTETES 
  ADD CONSTRAINT FK_JogviszonySzuneteltetes_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_JOGVISZONYSZUNETELTETES 
  ADD CONSTRAINT FK_JogviszonySzuneteltetes_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_SZIRSTATFILE 
  ADD CONSTRAINT FK_SzirStatFile_FileId_REF_File 
  FOREIGN KEY (C_FILEID) 
  REFERENCES [DBO].T_FILE (ID)
GO

ALTER TABLE [DBO].T_SZIRSTATFILE 
  ADD CONSTRAINT FK_SzirStatFile_KirSzirFeladatellatasiHelyId_REF_KirSzirFeladatellatasiHely 
  FOREIGN KEY (C_KIRSZIRFELADATELLATASIHELYID) 
  REFERENCES [DBO].T_KIRSZIRFELADATELLATASIHELY (ID)
GO

ALTER TABLE [DBO].T_SZIRSTATFILE 
  ADD CONSTRAINT FK_SzirStatFile_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_SZIRSTATFILE 
  ADD CONSTRAINT FK_SzirStatFile_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_EGYHAZTARTASBANELOK 
  ADD CONSTRAINT FK_EgyHaztartasbanElok_RogzitoGondviseloId_REF_Gondviselo 
  FOREIGN KEY (C_ROGZITOGONDVISELOID) 
  REFERENCES [DBO].T_GONDVISELO (ID)
GO

ALTER TABLE [DBO].T_EGYHAZTARTASBANELOK 
  ADD CONSTRAINT FK_EgyHaztartasbanElok_RogzitoFelhasznaloId_REF_Felhasznalo 
  FOREIGN KEY (C_ROGZITOFELHASZNALOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_EGYHAZTARTASBANELOK 
  ADD CONSTRAINT FK_EgyHaztartasbanElok_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_EGYHAZTARTASBANELOK 
  ADD CONSTRAINT FK_EgyHaztartasbanElok_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ALKALMAZOTTMUNKAKORTIPUS 
  ADD CONSTRAINT FK_AlkalmazottMunkaKorTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ALKALMAZOTTMUNKAKORTIPUS 
  ADD CONSTRAINT FK_AlkalmazottMunkaKorTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ALKALMAZOTTMUNKAKORTIPUS 
  ADD CONSTRAINT FK_AlkalmazottMunkaKorTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_DKT_FILE 
  ADD CONSTRAINT FK_DKT_File_FeltoltoTanuloId_REF_Tanulo 
  FOREIGN KEY (C_FELTOLTOTANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_DKT_FILE 
  ADD CONSTRAINT FK_DKT_File_FeltoltoAlkalmazottId_REF_Alkalmazott 
  FOREIGN KEY (C_FELTOLTOALKALMAZOTTID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_DKT_FILE 
  ADD CONSTRAINT FK_DKT_File_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_DKT_FILE 
  ADD CONSTRAINT FK_DKT_File_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_DKT_FELADATFILE 
  ADD CONSTRAINT FK_DKT_FeladatFile_FeladatId_REF_DKT_Feladat 
  FOREIGN KEY (C_FELADATID) 
  REFERENCES [DBO].T_DKT_FELADAT (ID)
GO

ALTER TABLE [DBO].T_DKT_FELADATFILE 
  ADD CONSTRAINT FK_DKT_FeladatFile_FileId_REF_DKT_File 
  FOREIGN KEY (C_FILEID) 
  REFERENCES [DBO].T_DKT_FILE (ID)
GO

ALTER TABLE [DBO].T_DKT_FELADATFILE 
  ADD CONSTRAINT FK_DKT_FeladatFile_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_DKT_FELADATFILE 
  ADD CONSTRAINT FK_DKT_FeladatFile_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_DKT_FELADAT 
  ADD CONSTRAINT FK_DKT_Feladat_TantargyId_REF_Tantargy 
  FOREIGN KEY (C_TANTARGYID) 
  REFERENCES [DBO].T_TANTARGY (ID)
GO

ALTER TABLE [DBO].T_DKT_FELADAT 
  ADD CONSTRAINT FK_DKT_Feladat_OsztalyCsoportId_REF_OsztalyCsoport 
  FOREIGN KEY (C_OSZTALYCSOPORTID) 
  REFERENCES [DBO].T_OSZTALYCSOPORT (ID)
GO

ALTER TABLE [DBO].T_DKT_FELADAT 
  ADD CONSTRAINT FK_DKT_Feladat_AlkalmazottId_REF_Alkalmazott 
  FOREIGN KEY (C_ALKALMAZOTTID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_DKT_FELADAT 
  ADD CONSTRAINT FK_DKT_Feladat_HelyettesitoAlkalmazottId_REF_Alkalmazott 
  FOREIGN KEY (C_HELYETTESITOALKALMAZOTTID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_DKT_FELADAT 
  ADD CONSTRAINT FK_DKT_Feladat_RogzitoAlkalmazottId_REF_Alkalmazott 
  FOREIGN KEY (C_ROGZITOALKALMAZOTTID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_DKT_FELADAT 
  ADD CONSTRAINT FK_DKT_Feladat_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_DKT_FELADAT 
  ADD CONSTRAINT FK_DKT_Feladat_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_MUNKAUGYTORVENYIHATALYTIPUS 
  ADD CONSTRAINT FK_MunkaugyTorvenyiHatalyTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_MUNKAUGYTORVENYIHATALYTIPUS 
  ADD CONSTRAINT FK_MunkaugyTorvenyiHatalyTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_MUNKAUGYTORVENYIHATALYTIPUS 
  ADD CONSTRAINT FK_MunkaugyTorvenyiHatalyTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_EGYEBTEVEKENYSEGEKTIPUS 
  ADD CONSTRAINT FK_EgyebTevekenysegekTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_EGYEBTEVEKENYSEGEKTIPUS 
  ADD CONSTRAINT FK_EgyebTevekenysegekTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_EGYEBTEVEKENYSEGEKTIPUS 
  ADD CONSTRAINT FK_EgyebTevekenysegekTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TOVABBKEPZES 
  ADD CONSTRAINT FK_Tovabbkepzes_AlkalmazottId_REF_Alkalmazott 
  FOREIGN KEY (C_ALKALMAZOTTID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_TOVABBKEPZES 
  ADD CONSTRAINT FK_Tovabbkepzes_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TOVABBKEPZES 
  ADD CONSTRAINT FK_Tovabbkepzes_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_AGAZATUJSZKTTIPUS 
  ADD CONSTRAINT FK_AgazatUjSzktTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_AGAZATUJSZKTTIPUS 
  ADD CONSTRAINT FK_AgazatUjSzktTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_AGAZATUJSZKTTIPUS 
  ADD CONSTRAINT FK_AgazatUjSzktTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_SZAKMATIPUS 
  ADD CONSTRAINT FK_SzakmaTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_SZAKMATIPUS 
  ADD CONSTRAINT FK_SzakmaTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_SZAKMATIPUS 
  ADD CONSTRAINT FK_SzakmaTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANULOSNI 
  ADD CONSTRAINT FK_TanuloSni_TanuloId_REF_Tanulo 
  FOREIGN KEY (C_TANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_TANULOSNI 
  ADD CONSTRAINT FK_TanuloSni_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANULOSNI 
  ADD CONSTRAINT FK_TanuloSni_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_SZAKMAIRANYTIPUS 
  ADD CONSTRAINT FK_SzakmairanyTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_SZAKMAIRANYTIPUS 
  ADD CONSTRAINT FK_SzakmairanyTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_SZAKMAIRANYTIPUS 
  ADD CONSTRAINT FK_SzakmairanyTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANULOTANTARGYATLAG 
  ADD CONSTRAINT FK_TanuloTantargyAtlag_TantargyId_REF_Tantargy 
  FOREIGN KEY (C_TANTARGYID) 
  REFERENCES [DBO].T_TANTARGY (ID)
GO

ALTER TABLE [DBO].T_TANULOTANTARGYATLAG 
  ADD CONSTRAINT FK_TanuloTantargyAtlag_TanuloId_REF_Tanulo 
  FOREIGN KEY (C_TANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_TANULOTANTARGYATLAG 
  ADD CONSTRAINT FK_TanuloTantargyAtlag_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANULOTANTARGYATLAG 
  ADD CONSTRAINT FK_TanuloTantargyAtlag_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_JUTTATAS 
  ADD CONSTRAINT FK_Juttatas_TanuloId_REF_Tanulo 
  FOREIGN KEY (C_TANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_JUTTATAS 
  ADD CONSTRAINT FK_Juttatas_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_JUTTATAS 
  ADD CONSTRAINT FK_Juttatas_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_JUTTATASTIPUS 
  ADD CONSTRAINT FK_JuttatasTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_JUTTATASTIPUS 
  ADD CONSTRAINT FK_JuttatasTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_JUTTATASTIPUS 
  ADD CONSTRAINT FK_JuttatasTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_JOGVISZONYTIPUS 
  ADD CONSTRAINT FK_JogviszonyTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_JOGVISZONYTIPUS 
  ADD CONSTRAINT FK_JogviszonyTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_JOGVISZONYTIPUS 
  ADD CONSTRAINT FK_JogviszonyTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_BANKSZAMLATULAJDONOSTIPUS 
  ADD CONSTRAINT FK_BankszamlaTulajdonosTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_BANKSZAMLATULAJDONOSTIPUS 
  ADD CONSTRAINT FK_BankszamlaTulajdonosTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_BANKSZAMLATULAJDONOSTIPUS 
  ADD CONSTRAINT FK_BankszamlaTulajdonosTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_AMIJELLEMZOTIPUS 
  ADD CONSTRAINT FK_AmiJellemzoTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_AMIJELLEMZOTIPUS 
  ADD CONSTRAINT FK_AmiJellemzoTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_AMIJELLEMZOTIPUS 
  ADD CONSTRAINT FK_AmiJellemzoTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_HAZIFELADATCSATOLMANY 
  ADD CONSTRAINT FK_HaziFeladatCsatolmany_HaziFeladatokId_REF_HaziFeladatok 
  FOREIGN KEY (C_HAZIFELADATOKID) 
  REFERENCES [DBO].T_HAZIFELADATOK (ID)
GO

ALTER TABLE [DBO].T_HAZIFELADATCSATOLMANY 
  ADD CONSTRAINT FK_HaziFeladatCsatolmany_CsatolmanyId_REF_Csatolmany 
  FOREIGN KEY (C_CSATOLMANYID) 
  REFERENCES [DBO].T_CSATOLMANY (ID)
GO

ALTER TABLE [DBO].T_HAZIFELADATCSATOLMANY 
  ADD CONSTRAINT FK_HaziFeladatCsatolmany_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_HAZIFELADATCSATOLMANY 
  ADD CONSTRAINT FK_HaziFeladatCsatolmany_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_TANTERVIJELLEMZOTIPUS 
  ADD CONSTRAINT FK_TanterviJellemzoTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_TANTERVIJELLEMZOTIPUS 
  ADD CONSTRAINT FK_TanterviJellemzoTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANTERVIJELLEMZOTIPUS 
  ADD CONSTRAINT FK_TanterviJellemzoTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_CSATOLMANY 
  ADD CONSTRAINT FK_Csatolmany_AdminFelhasznaloId_REF_Felhasznalo 
  FOREIGN KEY (C_ADMINFELHASZNALOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_CSATOLMANY 
  ADD CONSTRAINT FK_Csatolmany_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_CSATOLMANY 
  ADD CONSTRAINT FK_Csatolmany_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANULOHAZIFELADATSTATUSZ 
  ADD CONSTRAINT FK_TanuloHaziFeladatStatusz_TanuloId_REF_Tanulo 
  FOREIGN KEY (C_TANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_TANULOHAZIFELADATSTATUSZ 
  ADD CONSTRAINT FK_TanuloHaziFeladatStatusz_HaziFeladatokId_REF_HaziFeladatok 
  FOREIGN KEY (C_HAZIFELADATOKID) 
  REFERENCES [DBO].T_HAZIFELADATOK (ID)
GO

ALTER TABLE [DBO].T_TANULOHAZIFELADATSTATUSZ 
  ADD CONSTRAINT FK_TanuloHaziFeladatStatusz_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANULOHAZIFELADATSTATUSZ 
  ADD CONSTRAINT FK_TanuloHaziFeladatStatusz_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_DASHBOARDUZENETINTEZMENY 
  ADD CONSTRAINT FK_DashboardUzenetIntezmeny_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_DASHBOARDUZENETINTEZMENY 
  ADD CONSTRAINT FK_DashboardUzenetIntezmeny_DashboardUzenetId_REF_DashboardUzenet 
  FOREIGN KEY (C_DASHBOARDUZENETID) 
  REFERENCES [DBO].T_DASHBOARDUZENET (ID)
GO

ALTER TABLE [DBO].T_IKTATOTTDOKUMENTUMTAVOLLET 
  ADD CONSTRAINT FK_IktatottDokumentumTavollet_IktatottDokumentumId_REF_IktatottDokumentum 
  FOREIGN KEY (C_IKTATOTTDOKUMENTUMID) 
  REFERENCES [DBO].T_IKTATOTTDOKUMENTUM (ID)
GO

ALTER TABLE [DBO].T_IKTATOTTDOKUMENTUMTAVOLLET 
  ADD CONSTRAINT FK_IktatottDokumentumTavollet_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_IKTATOTTDOKUMENTUMTAVOLLET 
  ADD CONSTRAINT FK_IktatottDokumentumTavollet_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANULOKOZOSSEGISZOLGALATNYEL 
  ADD CONSTRAINT FK_TanuloKozossegiSzolgalatNyelv_TanuloKozossegiSzolgalatId_REF_TanuloKozossegiSzolgalat 
  FOREIGN KEY (C_TANULOKOZOSSEGISZOLGALATID) 
  REFERENCES [DBO].T_TANULOKOZOSSEGISZOLGALAT (ID)
GO

ALTER TABLE [DBO].T_TANULOKOZOSSEGISZOLGALATNYEL 
  ADD CONSTRAINT FK_TanuloKozossegiSzolgalatNyelv_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANULOKOZOSSEGISZOLGALATNYEL 
  ADD CONSTRAINT FK_TanuloKozossegiSzolgalatNyelv_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANULOERTEKELESNYELV 
  ADD CONSTRAINT FK_TanuloErtekelesNyelv_TanuloErtekelesId_REF_TanuloErtekeles 
  FOREIGN KEY (C_TANULOERTEKELESID) 
  REFERENCES [DBO].T_TANULOERTEKELES (ID)
GO

ALTER TABLE [DBO].T_TANULOERTEKELESNYELV 
  ADD CONSTRAINT FK_TanuloErtekelesNyelv_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANULOERTEKELESNYELV 
  ADD CONSTRAINT FK_TanuloErtekelesNyelv_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ERTEKELESMONDATBANKNYELV 
  ADD CONSTRAINT FK_ErtekelesMondatbankNyelv_ErtekelesMondatbankId_REF_ErtekelesMondatbank 
  FOREIGN KEY (C_ERTEKELESMONDATBANKID) 
  REFERENCES [DBO].T_ERTEKELESMONDATBANK (ID)
GO

ALTER TABLE [DBO].T_ERTEKELESMONDATBANKNYELV 
  ADD CONSTRAINT FK_ErtekelesMondatbankNyelv_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ERTEKELESMONDATBANKNYELV 
  ADD CONSTRAINT FK_ErtekelesMondatbankNyelv_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_DICTIONARYITEMBASENYELV 
  ADD CONSTRAINT FK_DictionaryItemBaseNyelv_DictionaryItemBaseId_REF_DictionaryItemBase 
  FOREIGN KEY (C_DICTIONARYITEMBASEID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)
GO

ALTER TABLE [DBO].T_DICTIONARYITEMBASENYELV 
  ADD CONSTRAINT FK_DictionaryItemBaseNyelv_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_DICTIONARYITEMBASENYELV 
  ADD CONSTRAINT FK_DictionaryItemBaseNyelv_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANULOESEMENYNYELV 
  ADD CONSTRAINT FK_TanuloEsemenyNyelv_TanuloEsemenyId_REF_TanuloEsemeny 
  FOREIGN KEY (C_TANULOESEMENYID) 
  REFERENCES [DBO].T_TANULOESEMENY (ID)
GO

ALTER TABLE [DBO].T_TANULOESEMENYNYELV 
  ADD CONSTRAINT FK_TanuloEsemenyNyelv_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANULOESEMENYNYELV 
  ADD CONSTRAINT FK_TanuloEsemenyNyelv_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ORASORSZAMOZASHALMAZ 
  ADD CONSTRAINT FK_OraSorszamozasHalmaz_OraSorszamozasHalmazOsszerendelesId_REF_OraSorszamozasHalmazOsszerendeles 
  FOREIGN KEY (C_ORASORSZAMOZASHALMAZOSSZEREN) 
  REFERENCES [DBO].T_ORASORSZAMOZASHALMAZOSSZEREN (ID)
GO

ALTER TABLE [DBO].T_ORASORSZAMOZASHALMAZ 
  ADD CONSTRAINT FK_OraSorszamozasHalmaz_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ORASORSZAMOZASHALMAZ 
  ADD CONSTRAINT FK_OraSorszamozasHalmaz_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ORASORSZAMOZASHALMAZOSSZEREN 
  ADD CONSTRAINT FK_OraSorszamozasHalmazOsszerendeles_TantargyId_REF_Tantargy 
  FOREIGN KEY (C_TANTARGYID) 
  REFERENCES [DBO].T_TANTARGY (ID)
GO

ALTER TABLE [DBO].T_ORASORSZAMOZASHALMAZOSSZEREN 
  ADD CONSTRAINT FK_OraSorszamozasHalmazOsszerendeles_OsztalyCsoportId_REF_OsztalyCsoport 
  FOREIGN KEY (C_OSZTALYCSOPORTID) 
  REFERENCES [DBO].T_OSZTALYCSOPORT (ID)
GO

ALTER TABLE [DBO].T_ORASORSZAMOZASHALMAZOSSZEREN 
  ADD CONSTRAINT FK_OraSorszamozasHalmazOsszerendeles_OraSorszamozasHalmazId_REF_OraSorszamozasHalmaz 
  FOREIGN KEY (C_ORASORSZAMOZASHALMAZID) 
  REFERENCES [DBO].T_ORASORSZAMOZASHALMAZ (ID)
GO

ALTER TABLE [DBO].T_ORASORSZAMOZASHALMAZOSSZEREN 
  ADD CONSTRAINT FK_OraSorszamozasHalmazOsszerendeles_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ORASORSZAMOZASHALMAZOSSZEREN 
  ADD CONSTRAINT FK_OraSorszamozasHalmazOsszerendeles_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANTARGYNYELV 
  ADD CONSTRAINT FK_TantargyNyelv_TantargyId_REF_Tantargy 
  FOREIGN KEY (C_TANTARGYID) 
  REFERENCES [DBO].T_TANTARGY (ID)
GO

ALTER TABLE [DBO].T_TANTARGYNYELV 
  ADD CONSTRAINT FK_TantargyNyelv_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANTARGYNYELV 
  ADD CONSTRAINT FK_TantargyNyelv_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_LEPELOADAS 
  ADD CONSTRAINT FK_LepEloadas_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_LEPELOADAS 
  ADD CONSTRAINT FK_LepEloadas_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ARANYJANOSPROGRAMTIPUS 
  ADD CONSTRAINT FK_AranyJanosProgramTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ARANYJANOSPROGRAMTIPUS 
  ADD CONSTRAINT FK_AranyJanosProgramTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ARANYJANOSPROGRAMTIPUS 
  ADD CONSTRAINT FK_AranyJanosProgramTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ADATTISZTITASSTATISZTIKA 
  ADD CONSTRAINT FK_AdattisztitasStatisztika_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ADATTISZTITASSTATISZTIKA 
  ADD CONSTRAINT FK_AdattisztitasStatisztika_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_AMITTFSABLON 
  ADD CONSTRAINT FK_AMITTFSablon_AMITantargySablonId_REF_AMITantargySablon 
  FOREIGN KEY (C_AMITANTARGYSABLONID) 
  REFERENCES [DBO].T_AMITANTARGYSABLON (ID)
GO

ALTER TABLE [DBO].T_LEPELOADASJEGYZEK 
  ADD CONSTRAINT FK_LepEloadasJegyzek_FelhasznaloId_REF_Felhasznalo 
  FOREIGN KEY (C_FELHASZNALOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_LEPELOADASJEGYZEK 
  ADD CONSTRAINT FK_LepEloadasJegyzek_GondviseloId_REF_Gondviselo 
  FOREIGN KEY (C_GONDVISELOID) 
  REFERENCES [DBO].T_GONDVISELO (ID)
GO

ALTER TABLE [DBO].T_LEPELOADASJEGYZEK 
  ADD CONSTRAINT FK_LepEloadasJegyzek_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_LEPELOADASJEGYZEK 
  ADD CONSTRAINT FK_LepEloadasJegyzek_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_SNITANULONEVELESIFORMATIPUS 
  ADD CONSTRAINT FK_SniTanuloNevelesiFormaTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_SNITANULONEVELESIFORMATIPUS 
  ADD CONSTRAINT FK_SniTanuloNevelesiFormaTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_SNITANULONEVELESIFORMATIPUS 
  ADD CONSTRAINT FK_SniTanuloNevelesiFormaTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_HETES 
  ADD CONSTRAINT FK_Hetes_TanuloId_REF_Tanulo 
  FOREIGN KEY (C_TANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_HETES 
  ADD CONSTRAINT FK_Hetes_OsztalyCsoportId_REF_OsztalyCsoport 
  FOREIGN KEY (C_OSZTALYCSOPORTID) 
  REFERENCES [DBO].T_OSZTALYCSOPORT (ID)
GO

ALTER TABLE [DBO].T_HETES 
  ADD CONSTRAINT FK_Hetes_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_HETES 
  ADD CONSTRAINT FK_Hetes_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_BESZERZESIIGENYMEGJEGYZES 
  ADD CONSTRAINT FK_BeszerzesiIgenyMegjegyzes_RogzitoId_REF_Felhasznalo 
  FOREIGN KEY (C_ROGZITOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_BESZERZESIIGENYMEGJEGYZES 
  ADD CONSTRAINT FK_BeszerzesiIgenyMegjegyzes_BeszerzesiIgenyId_REF_BeszerzesiIgeny 
  FOREIGN KEY (C_BESZERZESIIGENYID) 
  REFERENCES [DBO].T_BESZERZESIIGENY (ID)
GO

ALTER TABLE [DBO].T_BESZERZESIIGENYMEGJEGYZES 
  ADD CONSTRAINT FK_BeszerzesiIgenyMegjegyzes_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_BESZERZESIIGENYMEGJEGYZES 
  ADD CONSTRAINT FK_BeszerzesiIgenyMegjegyzes_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_BESZERZESIIGENY 
  ADD CONSTRAINT FK_BeszerzesiIgeny_RogzitoId_REF_Felhasznalo 
  FOREIGN KEY (C_ROGZITOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_BESZERZESIIGENY 
  ADD CONSTRAINT FK_BeszerzesiIgeny_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_BESZERZESIIGENY 
  ADD CONSTRAINT FK_BeszerzesiIgeny_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_BESZERZESISZALLITOTORZS 
  ADD CONSTRAINT FK_BeszerzesiSzallitotorzs_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_BESZERZESISZALLITOTORZS 
  ADD CONSTRAINT FK_BeszerzesiSzallitotorzs_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_BESZERZESIANYAG 
  ADD CONSTRAINT FK_BeszerzesiAnyag_BeszerzesiIgenyId_REF_BeszerzesiIgeny 
  FOREIGN KEY (C_BESZERZESIIGENYID) 
  REFERENCES [DBO].T_BESZERZESIIGENY (ID)
GO

ALTER TABLE [DBO].T_BESZERZESIANYAG 
  ADD CONSTRAINT FK_BeszerzesiAnyag_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_BESZERZESIANYAG 
  ADD CONSTRAINT FK_BeszerzesiAnyag_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_BESZERZESIIGENYDOKUMENTUM 
  ADD CONSTRAINT FK_BeszerzesiIgenyDokumentum_IktatottDokumentumId_REF_IktatottDokumentum 
  FOREIGN KEY (C_IKTATOTTDOKUMENTUMID) 
  REFERENCES [DBO].T_IKTATOTTDOKUMENTUM (ID)
GO

ALTER TABLE [DBO].T_BESZERZESIIGENYDOKUMENTUM 
  ADD CONSTRAINT FK_BeszerzesiIgenyDokumentum_BeszerzesiIgenyId_REF_BeszerzesiIgeny 
  FOREIGN KEY (C_BESZERZESIIGENYID) 
  REFERENCES [DBO].T_BESZERZESIIGENY (ID)
GO

ALTER TABLE [DBO].T_BESZERZESIIGENYDOKUMENTUM 
  ADD CONSTRAINT FK_BeszerzesiIgenyDokumentum_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_BESZERZESIIGENYDOKUMENTUM 
  ADD CONSTRAINT FK_BeszerzesiIgenyDokumentum_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_BESZERZESIANYAGTORZS 
  ADD CONSTRAINT FK_BeszerzesiAnyagtorzs_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_BESZERZESIANYAGTORZS 
  ADD CONSTRAINT FK_BeszerzesiAnyagtorzs_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_BESZERZESISZALLITO 
  ADD CONSTRAINT FK_BeszerzesiSzallito_BeszerzesiIgenyId_REF_BeszerzesiIgeny 
  FOREIGN KEY (C_BESZERZESIIGENYID) 
  REFERENCES [DBO].T_BESZERZESIIGENY (ID)
GO

ALTER TABLE [DBO].T_BESZERZESISZALLITO 
  ADD CONSTRAINT FK_BeszerzesiSzallito_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_BESZERZESISZALLITO 
  ADD CONSTRAINT FK_BeszerzesiSzallito_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_BESZERZESIIGENYSATUSZ 
  ADD CONSTRAINT FK_BeszerzesiIgenySatusz_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_BESZERZESIIGENYSATUSZ 
  ADD CONSTRAINT FK_BeszerzesiIgenySatusz_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_BESZERZESIIGENYSATUSZ 
  ADD CONSTRAINT FK_BeszerzesiIgenySatusz_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_MENNYISEGIEGYSEG 
  ADD CONSTRAINT FK_MennyisegiEgyseg_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_MENNYISEGIEGYSEG 
  ADD CONSTRAINT FK_MennyisegiEgyseg_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_MENNYISEGIEGYSEG 
  ADD CONSTRAINT FK_MennyisegiEgyseg_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_DASHBOARDUZENETFELHASZNALO 
  ADD CONSTRAINT FK_DashboardUzenetFelhasznalo_DashboardUzenetId_REF_DashboardUzenet 
  FOREIGN KEY (C_DASHBOARDUZENETID) 
  REFERENCES [DBO].T_DASHBOARDUZENET (ID)
GO

ALTER TABLE [DBO].T_DASHBOARDUZENETFELHASZNALO 
  ADD CONSTRAINT FK_DashboardUzenetFelhasznalo_FelhasznaloId_REF_Felhasznalo 
  FOREIGN KEY (C_FELHASZNALOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_DASHBOARDUZENETFELHASZNALO 
  ADD CONSTRAINT FK_DashboardUzenetFelhasznalo_GondviseloId_REF_Gondviselo 
  FOREIGN KEY (C_GONDVISELOID) 
  REFERENCES [DBO].T_GONDVISELO (ID)
GO

ALTER TABLE [DBO].T_DASHBOARDUZENETFELHASZNALO 
  ADD CONSTRAINT FK_DashboardUzenetFelhasznalo_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_DASHBOARDUZENETFELHASZNALO 
  ADD CONSTRAINT FK_DashboardUzenetFelhasznalo_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TEREM_FELTOLTOTTFAJL 
  ADD CONSTRAINT FK_Terem_FeltoltottFajl_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TEREM_FELTOLTOTTFAJL 
  ADD CONSTRAINT FK_Terem_FeltoltottFajl_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TEREM_FELTOLTOTTFAJL 
  ADD CONSTRAINT FK_Terem_FeltoltottFajl_FeltoltottFajlId_REF_FeltoltottFajl 
  FOREIGN KEY (C_FELTOLTOTTFAJLID) 
  REFERENCES [DBO].T_FELTOLTOTTFAJL (ID)
GO

ALTER TABLE [DBO].T_TEREM_FELTOLTOTTFAJL 
  ADD CONSTRAINT FK_Terem_FeltoltottFajl_TeremId_REF_Terem 
  FOREIGN KEY (C_TEREMID) 
  REFERENCES [DBO].T_TEREM (ID)
GO

ALTER TABLE [DBO].T_ELEARNINGFELHASZNALO 
  ADD CONSTRAINT FK_ElearningFelhasznalo_GondviseloId_REF_Gondviselo 
  FOREIGN KEY (C_GONDVISELOID) 
  REFERENCES [DBO].T_GONDVISELO (ID)
GO

ALTER TABLE [DBO].T_ELEARNINGFELHASZNALO 
  ADD CONSTRAINT FK_ElearningFelhasznalo_ElearningElerhetosegId_REF_ElearningElerhetoseg 
  FOREIGN KEY (C_ELEARNINGELERHETOSEGID) 
  REFERENCES [DBO].T_ELEARNINGELERHETOSEG (ID)
GO

ALTER TABLE [DBO].T_ELEARNINGFELHASZNALO 
  ADD CONSTRAINT FK_ElearningFelhasznalo_FelhasznaloId_REF_Felhasznalo 
  FOREIGN KEY (C_FELHASZNALOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_ELEARNINGFELHASZNALO 
  ADD CONSTRAINT FK_ElearningFelhasznalo_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ELEARNINGFELHASZNALO 
  ADD CONSTRAINT FK_ElearningFelhasznalo_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_FOGLALKOZASAMITANULO 
  ADD CONSTRAINT FK_FoglalkozasAmiTanulo_TanuloId_REF_Tanulo 
  FOREIGN KEY (C_TANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_FOGLALKOZASAMITANULO 
  ADD CONSTRAINT FK_FoglalkozasAmiTanulo_FoglalkozasId_REF_Foglalkozas 
  FOREIGN KEY (C_FOGLALKOZASID) 
  REFERENCES [DBO].T_FOGLALKOZAS (ID)
GO

ALTER TABLE [DBO].T_FOGLALKOZASAMITANULO 
  ADD CONSTRAINT FK_FoglalkozasAmiTanulo_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_FOGLALKOZASAMITANULO 
  ADD CONSTRAINT FK_FoglalkozasAmiTanulo_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_AMIFOTARGY 
  ADD CONSTRAINT FK_AMIFotargy_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_AMIFOTARGY 
  ADD CONSTRAINT FK_AMIFotargy_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_AMIFOTARGY 
  ADD CONSTRAINT FK_AMIFotargy_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_AMITANTARGYKOTELEZOSEG 
  ADD CONSTRAINT FK_AMITantargyKotelezoseg_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_AMITANTARGYKOTELEZOSEG 
  ADD CONSTRAINT FK_AMITantargyKotelezoseg_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_AMITANTARGYKOTELEZOSEG 
  ADD CONSTRAINT FK_AMITantargyKotelezoseg_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_AMITAGOZAT 
  ADD CONSTRAINT FK_AMITagozat_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_AMITAGOZAT 
  ADD CONSTRAINT FK_AMITagozat_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_AMITAGOZAT 
  ADD CONSTRAINT FK_AMITagozat_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_DASHBOARDUZENET 
  ADD CONSTRAINT FK_DashboardUzenet_DashboardUzenetKategoriaId_REF_DashboardUzenetKategoria 
  FOREIGN KEY (C_DASHBOARDUZENETKATEGORIAID) 
  REFERENCES [DBO].T_DASHBOARDUZENETKATEGORIA (ID)
GO

ALTER TABLE [DBO].T_EUGYINTEZESLOG 
  ADD CONSTRAINT FK_EugyintezesLog_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_EUGYINTEZESLOG 
  ADD CONSTRAINT FK_EugyintezesLog_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_SZAMONKERESELOREJELZES 
  ADD CONSTRAINT FK_SzamonkeresElorejelzes_RogzitoId_REF_Alkalmazott 
  FOREIGN KEY (C_ROGZITOID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_SZAMONKERESELOREJELZES 
  ADD CONSTRAINT FK_SzamonkeresElorejelzes_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_SZAMONKERESELOREJELZES 
  ADD CONSTRAINT FK_SzamonkeresElorejelzes_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_SAPTAVOLLET 
  ADD CONSTRAINT FK_SAPTavollet_AlkalmazottId_REF_Alkalmazott 
  FOREIGN KEY (C_ALKALMAZOTTID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_SAPTAVOLLET 
  ADD CONSTRAINT FK_SAPTavollet_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_SAPTAVOLLET 
  ADD CONSTRAINT FK_SAPTavollet_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_MUVESZETIAG 
  ADD CONSTRAINT FK_MuveszetiAg_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_MUVESZETIAG 
  ADD CONSTRAINT FK_MuveszetiAg_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_MUVESZETIAG 
  ADD CONSTRAINT FK_MuveszetiAg_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ZENEMUVESZETIAGTIPUS 
  ADD CONSTRAINT FK_ZenemuveszetiAgTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ZENEMUVESZETIAGTIPUS 
  ADD CONSTRAINT FK_ZenemuveszetiAgTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ZENEMUVESZETIAGTIPUS 
  ADD CONSTRAINT FK_ZenemuveszetiAgTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_FELTOLTOTTFAJL 
  ADD CONSTRAINT FK_FeltoltottFajl_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_FELTOLTOTTFAJL 
  ADD CONSTRAINT FK_FeltoltottFajl_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TAVOLLETJELENTO 
  ADD CONSTRAINT FK_TavolletJelento_RogzitoId_REF_Felhasznalo 
  FOREIGN KEY (C_ROGZITOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_TAVOLLETJELENTO 
  ADD CONSTRAINT FK_TavolletJelento_AlkalmazottId_REF_Alkalmazott 
  FOREIGN KEY (C_ALKALMAZOTTID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_TAVOLLETJELENTO 
  ADD CONSTRAINT FK_TavolletJelento_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TAVOLLETJELENTO 
  ADD CONSTRAINT FK_TavolletJelento_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ESLTANTARGYKATEGORIA 
  ADD CONSTRAINT FK_ESLTantargykategoria_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ESLTANTARGYKATEGORIA 
  ADD CONSTRAINT FK_ESLTantargykategoria_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ESLTANTARGYKATEGORIA 
  ADD CONSTRAINT FK_ESLTantargykategoria_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_TAVOLLETTIPUS 
  ADD CONSTRAINT FK_TavolletTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_TAVOLLETTIPUS 
  ADD CONSTRAINT FK_TavolletTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TAVOLLETTIPUS 
  ADD CONSTRAINT FK_TavolletTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_TAVOLLETSTATUSZ 
  ADD CONSTRAINT FK_TavolletStatusz_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_TAVOLLETSTATUSZ 
  ADD CONSTRAINT FK_TavolletStatusz_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TAVOLLETSTATUSZ 
  ADD CONSTRAINT FK_TavolletStatusz_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TEREMELERHETOSEG 
  ADD CONSTRAINT FK_TeremElerhetoseg_TeremId_REF_Terem 
  FOREIGN KEY (C_TEREMID) 
  REFERENCES [DBO].T_TEREM (ID)
GO

ALTER TABLE [DBO].T_TEREMELERHETOSEG 
  ADD CONSTRAINT FK_TeremElerhetoseg_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TEREMELERHETOSEG 
  ADD CONSTRAINT FK_TeremElerhetoseg_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANULOTANUGYIADATOK 
  ADD CONSTRAINT FK_TanuloTanugyiAdatok_TantervId_REF_Tanterv 
  FOREIGN KEY (C_TANTERVID) 
  REFERENCES [DBO].T_TANTERV (ID)
GO

ALTER TABLE [DBO].T_TANULOTANUGYIADATOK 
  ADD CONSTRAINT FK_TanuloTanugyiAdatok_FelvetelTaneveId_REF_Tanev 
  FOREIGN KEY (C_FELVETELTANEVEID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANULOTANUGYIADATOK 
  ADD CONSTRAINT FK_TanuloTanugyiAdatok_TanuloCsoportId_REF_TanuloCsoport 
  FOREIGN KEY (C_TANULOCSOPORTID) 
  REFERENCES [DBO].T_TANULOCSOPORT (ID)
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_TANULOTANUGYIADATOK' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_TanuloTanugyiAdatok_TanuloCsoportId_IntezmenyId_TanevId ON T_TANULOTANUGYIADATOK (C_TANULOCSOPORTID, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_TANULOTANUGYIADATOK' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_TanuloTanugyiAdatok_TanuloCsoportId_AlintezmenyId_AltanevId ON T_TANULOTANUGYIADATOK (C_TANULOCSOPORTID, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_TanuloTanugyiAdatok_TanuloCsoportId ON T_TANULOTANUGYIADATOK (C_TANULOCSOPORTID) WHERE TOROLT = 'F'
END
GO

ALTER TABLE [DBO].T_TANULOTANUGYIADATOK 
  ADD CONSTRAINT FK_TanuloTanugyiAdatok_SzervezetId_REF_Szervezet 
  FOREIGN KEY (C_SZERVEZETID) 
  REFERENCES [DBO].T_SZERVEZET (ID)
GO

ALTER TABLE [DBO].T_TANULOTANUGYIADATOK 
  ADD CONSTRAINT FK_TanuloTanugyiAdatok_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANULOTANUGYIADATOK 
  ADD CONSTRAINT FK_TanuloTanugyiAdatok_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ELVEGZETTKURZUS 
  ADD CONSTRAINT FK_ElvegzettKurzus_GondviseloId_REF_Gondviselo 
  FOREIGN KEY (C_GONDVISELOID) 
  REFERENCES [DBO].T_GONDVISELO (ID)
GO

ALTER TABLE [DBO].T_ELVEGZETTKURZUS 
  ADD CONSTRAINT FK_ElvegzettKurzus_KurzusId_REF_Kurzus 
  FOREIGN KEY (C_KURZUSID) 
  REFERENCES [DBO].T_KURZUS (ID)
GO

ALTER TABLE [DBO].T_ELVEGZETTKURZUS 
  ADD CONSTRAINT FK_ElvegzettKurzus_FelhasznaloId_REF_Felhasznalo 
  FOREIGN KEY (C_FELHASZNALOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_ELVEGZETTKURZUS 
  ADD CONSTRAINT FK_ElvegzettKurzus_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ELVEGZETTKURZUS 
  ADD CONSTRAINT FK_ElvegzettKurzus_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_KURZUS 
  ADD CONSTRAINT FK_Kurzus_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KURZUS 
  ADD CONSTRAINT FK_Kurzus_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_DOKUMENTUMELEMISZINT 
  ADD CONSTRAINT FK_DokumentumElemiSzint_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_DOKUMENTUMELEMISZINT 
  ADD CONSTRAINT FK_DokumentumElemiSzint_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_DOKUMENTUMELEMISZINT 
  ADD CONSTRAINT FK_DokumentumElemiSzint_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_FOGADOORAIDOPONT_GONDVISELO 
  ADD CONSTRAINT FK_FogadooraIdopont_Gondviselo_FogadooraIdopontId_REF_FogadooraIdopont 
  FOREIGN KEY (C_FOGADOORAIDOPONTID) 
  REFERENCES [DBO].T_FOGADOORAIDOPONT (ID)
GO

ALTER TABLE [DBO].T_FOGADOORAIDOPONT_GONDVISELO 
  ADD CONSTRAINT FK_FogadooraIdopont_Gondviselo_GondviseloId_REF_Gondviselo 
  FOREIGN KEY (C_GONDVISELOID) 
  REFERENCES [DBO].T_GONDVISELO (ID)
GO

ALTER TABLE [DBO].T_FOGADOORAIDOPONT_GONDVISELO 
  ADD CONSTRAINT FK_FogadooraIdopont_Gondviselo_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_FOGADOORAIDOPONT_GONDVISELO 
  ADD CONSTRAINT FK_FogadooraIdopont_Gondviselo_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_FOGADOORA_OSZTALYCSOPORT 
  ADD CONSTRAINT FK_Fogadoora_OsztalyCsoport_OsztalyCsoportId_REF_OsztalyCsoport 
  FOREIGN KEY (C_OSZTALYCSOPORTID) 
  REFERENCES [DBO].T_OSZTALYCSOPORT (ID)
GO

ALTER TABLE [DBO].T_FOGADOORA_OSZTALYCSOPORT 
  ADD CONSTRAINT FK_Fogadoora_OsztalyCsoport_FogadooraId_REF_Fogadoora 
  FOREIGN KEY (C_FOGADOORAID) 
  REFERENCES [DBO].T_FOGADOORA (ID)
GO

ALTER TABLE [DBO].T_FOGADOORA_OSZTALYCSOPORT 
  ADD CONSTRAINT FK_Fogadoora_OsztalyCsoport_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_FOGADOORA_OSZTALYCSOPORT 
  ADD CONSTRAINT FK_Fogadoora_OsztalyCsoport_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_FOGADOORAIDOPONT 
  ADD CONSTRAINT FK_FogadooraIdopont_FogadooraId_REF_Fogadoora 
  FOREIGN KEY (C_FOGADOORAID) 
  REFERENCES [DBO].T_FOGADOORA (ID)
GO

ALTER TABLE [DBO].T_FOGADOORAIDOPONT 
  ADD CONSTRAINT FK_FogadooraIdopont_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_FOGADOORAIDOPONT 
  ADD CONSTRAINT FK_FogadooraIdopont_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_FOGADOORA 
  ADD CONSTRAINT FK_Fogadoora_NemKotottMunkaidoId_REF_NemKotottMunkaido 
  FOREIGN KEY (C_NEMKOTOTTMUNKAIDOID) 
  REFERENCES [DBO].T_NEMKOTOTTMUNKAIDO (ID)
GO

ALTER TABLE [DBO].T_FOGADOORA 
  ADD CONSTRAINT FK_Fogadoora_TanarId_REF_Alkalmazott 
  FOREIGN KEY (C_TANARID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_FOGADOORA 
  ADD CONSTRAINT FK_Fogadoora_TeremId_REF_Terem 
  FOREIGN KEY (C_TEREMID) 
  REFERENCES [DBO].T_TEREM (ID)
GO

ALTER TABLE [DBO].T_FOGADOORA 
  ADD CONSTRAINT FK_Fogadoora_TanuloEsemenyId_REF_TanuloEsemeny 
  FOREIGN KEY (C_TANULOESEMENYID) 
  REFERENCES [DBO].T_TANULOESEMENY (ID)
GO

ALTER TABLE [DBO].T_FOGADOORA 
  ADD CONSTRAINT FK_Fogadoora_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_FOGADOORA 
  ADD CONSTRAINT FK_Fogadoora_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ELEARNINGELERHETOSEG 
  ADD CONSTRAINT FK_ElearningElerhetoseg_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ELEARNINGELERHETOSEG 
  ADD CONSTRAINT FK_ElearningElerhetoseg_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_OKTNEVELESIKATEGORIA 
  ADD CONSTRAINT FK_OktNevelesiKategoria_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_OKTNEVELESIKATEGORIA 
  ADD CONSTRAINT FK_OktNevelesiKategoria_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_OKTNEVELESIKATEGORIA 
  ADD CONSTRAINT FK_OktNevelesiKategoria_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_DOKUMENTUM 
  ADD CONSTRAINT FK_Dokumentum_IktatottDokumentumId_REF_IktatottDokumentum 
  FOREIGN KEY (C_IKTATOTTDOKUMENTUMID) 
  REFERENCES [DBO].T_IKTATOTTDOKUMENTUM (ID)
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_DOKUMENTUM' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_Dokumentum_IktatottDokumentumId_IntezmenyId_TanevId ON T_DOKUMENTUM (C_IKTATOTTDOKUMENTUMID, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_DOKUMENTUM' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_Dokumentum_IktatottDokumentumId_AlintezmenyId_AltanevId ON T_DOKUMENTUM (C_IKTATOTTDOKUMENTUMID, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_Dokumentum_IktatottDokumentumId ON T_DOKUMENTUM (C_IKTATOTTDOKUMENTUMID) WHERE TOROLT = 'F'
END
GO

ALTER TABLE [DBO].T_DOKUMENTUM 
  ADD CONSTRAINT FK_Dokumentum_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_DOKUMENTUM 
  ADD CONSTRAINT FK_Dokumentum_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_DOKUMENTUMKULCSSZOERTEK 
  ADD CONSTRAINT FK_DokumentumKulcsszoErtek_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_DOKUMENTUMKULCSSZOERTEK 
  ADD CONSTRAINT FK_DokumentumKulcsszoErtek_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_IKTATOTTDOKUMENTUM 
  ADD CONSTRAINT FK_IktatottDokumentum_FeladatEllatasiHelyId_REF_FeladatEllatasiHely 
  FOREIGN KEY (C_FELADATELLATASIHELYID) 
  REFERENCES [DBO].T_FELADATELLATASIHELY (ID)
GO

ALTER TABLE [DBO].T_IKTATOTTDOKUMENTUM 
  ADD CONSTRAINT FK_IktatottDokumentum_IktatoSzemelyId_REF_Felhasznalo 
  FOREIGN KEY (C_IKTATOSZEMELYID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_IKTATOTTDOKUMENTUM 
  ADD CONSTRAINT FK_IktatottDokumentum_FoszamosIktatottDokumentumId_REF_IktatottDokumentum 
  FOREIGN KEY (C_FOSZAMOSIKTATOTTDOKUMENTUMID) 
  REFERENCES [DBO].T_IKTATOTTDOKUMENTUM (ID)
GO

ALTER TABLE [DBO].T_IKTATOTTDOKUMENTUM 
  ADD CONSTRAINT FK_IktatottDokumentum_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_IKTATOTTDOKUMENTUM 
  ADD CONSTRAINT FK_IktatottDokumentum_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_DOKUMENTUMKULCSSZO 
  ADD CONSTRAINT FK_DokumentumKulcsszo_IktatottDokumentumId_REF_IktatottDokumentum 
  FOREIGN KEY (C_IKTATOTTDOKUMENTUMID) 
  REFERENCES [DBO].T_IKTATOTTDOKUMENTUM (ID)
GO

ALTER TABLE [DBO].T_DOKUMENTUMKULCSSZO 
  ADD CONSTRAINT FK_DokumentumKulcsszo_DokumentumKulcsszoErtekId_REF_DokumentumKulcsszoErtek 
  FOREIGN KEY (C_DOKUMENTUMKULCSSZOERTEKID) 
  REFERENCES [DBO].T_DOKUMENTUMKULCSSZOERTEK (ID)
GO

ALTER TABLE [DBO].T_DOKUMENTUMKULCSSZO 
  ADD CONSTRAINT FK_DokumentumKulcsszo_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_DOKUMENTUMKULCSSZO 
  ADD CONSTRAINT FK_DokumentumKulcsszo_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_DOKUMENTUMTIPUS 
  ADD CONSTRAINT FK_DokumentumTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_DOKUMENTUMTIPUS 
  ADD CONSTRAINT FK_DokumentumTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_DOKUMENTUMTIPUS 
  ADD CONSTRAINT FK_DokumentumTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_DOKUMENTUMSTATUSZ 
  ADD CONSTRAINT FK_DokumentumStatusz_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_DOKUMENTUMSTATUSZ 
  ADD CONSTRAINT FK_DokumentumStatusz_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_DOKUMENTUMSTATUSZ 
  ADD CONSTRAINT FK_DokumentumStatusz_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_DOKUMENTUMKULCSSZOTIPUS 
  ADD CONSTRAINT FK_DokumentumKulcsszoTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_DOKUMENTUMKULCSSZOTIPUS 
  ADD CONSTRAINT FK_DokumentumKulcsszoTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_DOKUMENTUMKULCSSZOTIPUS 
  ADD CONSTRAINT FK_DokumentumKulcsszoTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_DOKUMENTUMKATEGORIA 
  ADD CONSTRAINT FK_DokumentumKategoria_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_DOKUMENTUMKATEGORIA 
  ADD CONSTRAINT FK_DokumentumKategoria_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_DOKUMENTUMKATEGORIA 
  ADD CONSTRAINT FK_DokumentumKategoria_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_JELSZOMODOSITASLINK 
  ADD CONSTRAINT FK_JelszoModositasLink_FelhasznaloId_REF_Felhasznalo 
  FOREIGN KEY (C_FELHASZNALOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_JELSZOMODOSITASLINK 
  ADD CONSTRAINT FK_JelszoModositasLink_GondviseloId_REF_Gondviselo 
  FOREIGN KEY (C_GONDVISELOID) 
  REFERENCES [DBO].T_GONDVISELO (ID)
GO

ALTER TABLE [DBO].T_JELSZOMODOSITASLINK 
  ADD CONSTRAINT FK_JelszoModositasLink_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_JELSZOMODOSITASLINK 
  ADD CONSTRAINT FK_JelszoModositasLink_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_DIAKOLIMPIA 
  ADD CONSTRAINT FK_Diakolimpia_TanuloId_REF_Tanulo 
  FOREIGN KEY (C_TANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_DIAKOLIMPIA 
  ADD CONSTRAINT FK_Diakolimpia_TanarId_REF_Alkalmazott 
  FOREIGN KEY (C_TANARID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_DIAKOLIMPIA 
  ADD CONSTRAINT FK_Diakolimpia_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_DIAKOLIMPIA 
  ADD CONSTRAINT FK_Diakolimpia_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ERTMONDATBANKTIPUS 
  ADD CONSTRAINT FK_ErtMondatbankTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ERTMONDATBANKTIPUS 
  ADD CONSTRAINT FK_ErtMondatbankTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ERTMONDATBANKTIPUS 
  ADD CONSTRAINT FK_ErtMondatbankTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_KKTANTARGYKATEGORIA 
  ADD CONSTRAINT FK_KKTantargyKategoria_KKTanarVegzettsegId_REF_KKTanarVegzettseg 
  FOREIGN KEY (C_KKTANARVEGZETTSEGID) 
  REFERENCES [DBO].T_KKTANARVEGZETTSEG (ID)
GO

ALTER TABLE [DBO].T_KKTANTARGYKATEGORIA 
  ADD CONSTRAINT FK_KKTantargyKategoria_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KKTANTARGYKATEGORIA 
  ADD CONSTRAINT FK_KKTantargyKategoria_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_KKKEPESITESJELLTIPUS 
  ADD CONSTRAINT FK_KKKepesitesJellTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_KKKEPESITESJELLTIPUS 
  ADD CONSTRAINT FK_KKKepesitesJellTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KKKEPESITESJELLTIPUS 
  ADD CONSTRAINT FK_KKKepesitesJellTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_KKJAZZZENE 
  ADD CONSTRAINT FK_KKJazzZene_KKAMIVegzettsegId_REF_KKAMIVegzettseg 
  FOREIGN KEY (C_KKAMIVEGZETTSEGID) 
  REFERENCES [DBO].T_KKAMIVEGZETTSEG (ID)
GO

ALTER TABLE [DBO].T_KKJAZZZENE 
  ADD CONSTRAINT FK_KKJazzZene_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KKJAZZZENE 
  ADD CONSTRAINT FK_KKJazzZene_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_KKKLASSZIKUSZENE 
  ADD CONSTRAINT FK_KKKlasszikusZene_KKAMIVegzettsegId_REF_KKAMIVegzettseg 
  FOREIGN KEY (C_KKAMIVEGZETTSEGID) 
  REFERENCES [DBO].T_KKAMIVEGZETTSEG (ID)
GO

ALTER TABLE [DBO].T_KKKLASSZIKUSZENE 
  ADD CONSTRAINT FK_KKKlasszikusZene_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KKKLASSZIKUSZENE 
  ADD CONSTRAINT FK_KKKlasszikusZene_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_KKAMIVEGZETTSEG 
  ADD CONSTRAINT FK_KKAMIVegzettseg_AlkalmazottId_REF_Alkalmazott 
  FOREIGN KEY (C_ALKALMAZOTTID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_KKAMIVEGZETTSEG 
  ADD CONSTRAINT FK_KKAMIVegzettseg_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KKAMIVEGZETTSEG 
  ADD CONSTRAINT FK_KKAMIVegzettseg_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_KKGYOGYPEDVEGZETTSEG 
  ADD CONSTRAINT FK_KKGyogypedVegzettseg_AlkalmazottId_REF_Alkalmazott 
  FOREIGN KEY (C_ALKALMAZOTTID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_KKGYOGYPEDVEGZETTSEG 
  ADD CONSTRAINT FK_KKGyogypedVegzettseg_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KKGYOGYPEDVEGZETTSEG 
  ADD CONSTRAINT FK_KKGyogypedVegzettseg_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_KKNEPZENE 
  ADD CONSTRAINT FK_KKNepzene_KKAMIVegzettsegId_REF_KKAMIVegzettseg 
  FOREIGN KEY (C_KKAMIVEGZETTSEGID) 
  REFERENCES [DBO].T_KKAMIVEGZETTSEG (ID)
GO

ALTER TABLE [DBO].T_KKNEPZENE 
  ADD CONSTRAINT FK_KKNepzene_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KKNEPZENE 
  ADD CONSTRAINT FK_KKNepzene_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_KKELEKTROAKUZENE 
  ADD CONSTRAINT FK_KKElektroakuZene_KKAMIVegzettsegId_REF_KKAMIVegzettseg 
  FOREIGN KEY (C_KKAMIVEGZETTSEGID) 
  REFERENCES [DBO].T_KKAMIVEGZETTSEG (ID)
GO

ALTER TABLE [DBO].T_KKELEKTROAKUZENE 
  ADD CONSTRAINT FK_KKElektroakuZene_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KKELEKTROAKUZENE 
  ADD CONSTRAINT FK_KKElektroakuZene_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_KKTERULET 
  ADD CONSTRAINT FK_KKTerulet_KKAMIVegzettsegId_REF_KKAMIVegzettseg 
  FOREIGN KEY (C_KKAMIVEGZETTSEGID) 
  REFERENCES [DBO].T_KKAMIVEGZETTSEG (ID)
GO

ALTER TABLE [DBO].T_KKTERULET 
  ADD CONSTRAINT FK_KKTerulet_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KKTERULET 
  ADD CONSTRAINT FK_KKTerulet_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_KKTANARVEGZETTSEG 
  ADD CONSTRAINT FK_KKTanarVegzettseg_AlkalmazottId_REF_Alkalmazott 
  FOREIGN KEY (C_ALKALMAZOTTID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_KKTANARVEGZETTSEG 
  ADD CONSTRAINT FK_KKTanarVegzettseg_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KKTANARVEGZETTSEG 
  ADD CONSTRAINT FK_KKTanarVegzettseg_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_KKTANITOVEZGETTSEG 
  ADD CONSTRAINT FK_KKTanitoVezgettseg_AlkalmazottId_REF_Alkalmazott 
  FOREIGN KEY (C_ALKALMAZOTTID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_KKTANITOVEZGETTSEG 
  ADD CONSTRAINT FK_KKTanitoVezgettseg_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KKTANITOVEZGETTSEG 
  ADD CONSTRAINT FK_KKTanitoVezgettseg_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_KKVEGZETTSEGTIPUS 
  ADD CONSTRAINT FK_KKVegzettsegTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_KKVEGZETTSEGTIPUS 
  ADD CONSTRAINT FK_KKVegzettsegTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KKVEGZETTSEGTIPUS 
  ADD CONSTRAINT FK_KKVegzettsegTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_KKAMINEPZENETIPUS 
  ADD CONSTRAINT FK_KKAMINepzeneTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_KKAMINEPZENETIPUS 
  ADD CONSTRAINT FK_KKAMINepzeneTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KKAMINEPZENETIPUS 
  ADD CONSTRAINT FK_KKAMINepzeneTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_KKAMIELEKTROAKUTIPUS 
  ADD CONSTRAINT FK_KKAMIElektroakuTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_KKAMIELEKTROAKUTIPUS 
  ADD CONSTRAINT FK_KKAMIElektroakuTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KKAMIELEKTROAKUTIPUS 
  ADD CONSTRAINT FK_KKAMIElektroakuTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_KKAMIVEGZETTSEGTIPUS 
  ADD CONSTRAINT FK_KKAMIVegzettsegTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_KKAMIVEGZETTSEGTIPUS 
  ADD CONSTRAINT FK_KKAMIVegzettsegTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KKAMIVEGZETTSEGTIPUS 
  ADD CONSTRAINT FK_KKAMIVegzettsegTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_KKAMITERULETTIPUS 
  ADD CONSTRAINT FK_KKAMITeruletTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_KKAMITERULETTIPUS 
  ADD CONSTRAINT FK_KKAMITeruletTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KKAMITERULETTIPUS 
  ADD CONSTRAINT FK_KKAMITeruletTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_KKAMIJAZZZENETIPUS 
  ADD CONSTRAINT FK_KKAMIJazzZeneTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_KKAMIJAZZZENETIPUS 
  ADD CONSTRAINT FK_KKAMIJazzZeneTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KKAMIJAZZZENETIPUS 
  ADD CONSTRAINT FK_KKAMIJazzZeneTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_KKTANITOMUVTERTIPUS 
  ADD CONSTRAINT FK_KKTanitoMuvTerTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_KKTANITOMUVTERTIPUS 
  ADD CONSTRAINT FK_KKTanitoMuvTerTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KKTANITOMUVTERTIPUS 
  ADD CONSTRAINT FK_KKTanitoMuvTerTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_KKAMIKLASSZIKUSTIPUS 
  ADD CONSTRAINT FK_KKAMIKlasszikusTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_KKAMIKLASSZIKUSTIPUS 
  ADD CONSTRAINT FK_KKAMIKlasszikusTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KKAMIKLASSZIKUSTIPUS 
  ADD CONSTRAINT FK_KKAMIKlasszikusTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_KKGYOGYPEDTERTIPUS 
  ADD CONSTRAINT FK_KKGyogypedTerTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_KKGYOGYPEDTERTIPUS 
  ADD CONSTRAINT FK_KKGyogypedTerTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KKGYOGYPEDTERTIPUS 
  ADD CONSTRAINT FK_KKGyogypedTerTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_KKKEPESITESTIPUS 
  ADD CONSTRAINT FK_KKKepesitesTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_KKKEPESITESTIPUS 
  ADD CONSTRAINT FK_KKKepesitesTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KKKEPESITESTIPUS 
  ADD CONSTRAINT FK_KKKepesitesTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_KKSZAKTIPUS 
  ADD CONSTRAINT FK_KKSzakTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_KKSZAKTIPUS 
  ADD CONSTRAINT FK_KKSzakTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KKSZAKTIPUS 
  ADD CONSTRAINT FK_KKSzakTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_KKAMIZENEMUVKATTIPUS 
  ADD CONSTRAINT FK_KKAMIZenemuvKatTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_KKAMIZENEMUVKATTIPUS 
  ADD CONSTRAINT FK_KKAMIZenemuvKatTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KKAMIZENEMUVKATTIPUS 
  ADD CONSTRAINT FK_KKAMIZenemuvKatTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_OSSZEFUGGOSZAKGYAK 
  ADD CONSTRAINT FK_OsszefuggoSzakGyak_TantargyId_REF_Tantargy 
  FOREIGN KEY (C_TANTARGYID) 
  REFERENCES [DBO].T_TANTARGY (ID)
GO

ALTER TABLE [DBO].T_OSSZEFUGGOSZAKGYAK 
  ADD CONSTRAINT FK_OsszefuggoSzakGyak_TanuloId_REF_Tanulo 
  FOREIGN KEY (C_TANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_OSSZEFUGGOSZAKGYAK 
  ADD CONSTRAINT FK_OsszefuggoSzakGyak_CsoportId_REF_Csoport 
  FOREIGN KEY (C_CSOPORTID) 
  REFERENCES [DBO].T_CSOPORT (ID)
GO

ALTER TABLE [DBO].T_OSSZEFUGGOSZAKGYAK 
  ADD CONSTRAINT FK_OsszefuggoSzakGyak_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_OSSZEFUGGOSZAKGYAK 
  ADD CONSTRAINT FK_OsszefuggoSzakGyak_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_KIRKONTENERELEMSTATUSZ 
  ADD CONSTRAINT FK_KIRKontenerElemStatusz_KIRKontenerElemId_REF_KIRKontenerElem 
  FOREIGN KEY (C_KIRKONTENERELEMID) 
  REFERENCES [DBO].T_KIRKONTENERELEM (ID)
GO

ALTER TABLE [DBO].T_KIRKONTENERELEMSTATUSZ 
  ADD CONSTRAINT FK_KIRKontenerElemStatusz_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KIRKONTENERELEMSTATUSZ 
  ADD CONSTRAINT FK_KIRKontenerElemStatusz_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_KIRKONTENER 
  ADD CONSTRAINT FK_KIRKontener_FelhasznaloId_REF_Felhasznalo 
  FOREIGN KEY (C_FELHASZNALOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_KIRKONTENER 
  ADD CONSTRAINT FK_KIRKontener_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KIRKONTENER 
  ADD CONSTRAINT FK_KIRKontener_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_KIRKONTENERSTATUSZ 
  ADD CONSTRAINT FK_KIRKontenerStatusz_KIRKontenerId_REF_KIRKontener 
  FOREIGN KEY (C_KIRKONTENERID) 
  REFERENCES [DBO].T_KIRKONTENER (ID)
GO

ALTER TABLE [DBO].T_KIRKONTENERSTATUSZ 
  ADD CONSTRAINT FK_KIRKontenerStatusz_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KIRKONTENERSTATUSZ 
  ADD CONSTRAINT FK_KIRKontenerStatusz_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_KIRKONTENERELEM 
  ADD CONSTRAINT FK_KIRKontenerElem_KIRKontenerId_REF_KIRKontener 
  FOREIGN KEY (C_KIRKONTENERID) 
  REFERENCES [DBO].T_KIRKONTENER (ID)
GO

ALTER TABLE [DBO].T_KIRKONTENERELEM 
  ADD CONSTRAINT FK_KIRKontenerElem_NebuloId_REF_Nebulo 
  FOREIGN KEY (C_NEBULOID) 
  REFERENCES [DBO].T_NEBULO (ID)
GO

ALTER TABLE [DBO].T_KIRKONTENERELEM 
  ADD CONSTRAINT FK_KIRKontenerElem_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KIRKONTENERELEM 
  ADD CONSTRAINT FK_KIRKontenerElem_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_KIRSZOLGALTATASTIPUS 
  ADD CONSTRAINT FK_KirSzolgaltatasTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_KIRSZOLGALTATASTIPUS 
  ADD CONSTRAINT FK_KirSzolgaltatasTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KIRSZOLGALTATASTIPUS 
  ADD CONSTRAINT FK_KirSzolgaltatasTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_SZAKTIPUS 
  ADD CONSTRAINT FK_SzakTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_SZAKTIPUS 
  ADD CONSTRAINT FK_SzakTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_SZAKTIPUS 
  ADD CONSTRAINT FK_SzakTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_GIMNAZIUMIEVFOLYAMTIPUS 
  ADD CONSTRAINT FK_GimnaziumiEvfolyamTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_GIMNAZIUMIEVFOLYAMTIPUS 
  ADD CONSTRAINT FK_GimnaziumiEvfolyamTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_GIMNAZIUMIEVFOLYAMTIPUS 
  ADD CONSTRAINT FK_GimnaziumiEvfolyamTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_KEPESITES 
  ADD CONSTRAINT FK_Kepesites_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KEPESITES 
  ADD CONSTRAINT FK_Kepesites_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_VEGZETTSEG 
  ADD CONSTRAINT FK_Vegzettseg_TanarId_REF_Felhasznalo 
  FOREIGN KEY (C_TANARID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_VEGZETTSEG 
  ADD CONSTRAINT FK_Vegzettseg_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_VEGZETTSEG 
  ADD CONSTRAINT FK_Vegzettseg_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANULOHAZIFELADAT 
  ADD CONSTRAINT FK_TanuloHaziFeladat_HaziFeladatId_REF_HaziFeladatok 
  FOREIGN KEY (C_HAZIFELADATID) 
  REFERENCES [DBO].T_HAZIFELADATOK (ID)
GO

ALTER TABLE [DBO].T_TANULOHAZIFELADAT 
  ADD CONSTRAINT FK_TanuloHaziFeladat_RogzitoId_REF_Felhasznalo 
  FOREIGN KEY (C_ROGZITOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_TANULOHAZIFELADAT 
  ADD CONSTRAINT FK_TanuloHaziFeladat_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANULOHAZIFELADAT 
  ADD CONSTRAINT FK_TanuloHaziFeladat_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ERETTSEGIVALASZ 
  ADD CONSTRAINT FK_ErettsegiValasz_TanuloId_REF_Tanulo 
  FOREIGN KEY (C_TANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_ERETTSEGIVALASZ 
  ADD CONSTRAINT FK_ErettsegiValasz_ErettsegiKerdesId_REF_ErettsegiKerdes 
  FOREIGN KEY (C_ERETTSEGIKERDESID) 
  REFERENCES [DBO].T_ERETTSEGIKERDES (ID)
GO

ALTER TABLE [DBO].T_ERETTSEGIVALASZ 
  ADD CONSTRAINT FK_ErettsegiValasz_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ERETTSEGIVALASZ 
  ADD CONSTRAINT FK_ErettsegiValasz_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ERETTSEGIKERDES 
  ADD CONSTRAINT FK_ErettsegiKerdes_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ERETTSEGIKERDES 
  ADD CONSTRAINT FK_ErettsegiKerdes_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_LICENCEFUNKCIOKTIPUS 
  ADD CONSTRAINT FK_LicenceFunkciokTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_LICENCEFUNKCIOKTIPUS 
  ADD CONSTRAINT FK_LicenceFunkciokTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_LICENCEFUNKCIOKTIPUS 
  ADD CONSTRAINT FK_LicenceFunkciokTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_LICENCE 
  ADD CONSTRAINT FK_Licence_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_LICENCE 
  ADD CONSTRAINT FK_Licence_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_PENZNEMTIPUS 
  ADD CONSTRAINT FK_PenznemTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_PENZNEMTIPUS 
  ADD CONSTRAINT FK_PenznemTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_PENZNEMTIPUS 
  ADD CONSTRAINT FK_PenznemTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_MEROALLAS 
  ADD CONSTRAINT FK_Meroallas_MerohelyId_REF_Merohely 
  FOREIGN KEY (C_MEROHELYID) 
  REFERENCES [DBO].T_MEROHELY (ID)
GO

ALTER TABLE [DBO].T_MEROALLAS 
  ADD CONSTRAINT FK_Meroallas_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_MEROALLAS 
  ADD CONSTRAINT FK_Meroallas_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_MEROHELYTIPUS 
  ADD CONSTRAINT FK_MerohelyTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_MEROHELYTIPUS 
  ADD CONSTRAINT FK_MerohelyTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_MEROHELYTIPUS 
  ADD CONSTRAINT FK_MerohelyTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_KOZMUSZAMLA 
  ADD CONSTRAINT FK_KozmuSzamla_MerohelyId_REF_Merohely 
  FOREIGN KEY (C_MEROHELYID) 
  REFERENCES [DBO].T_MEROHELY (ID)
GO

ALTER TABLE [DBO].T_KOZMUSZAMLA 
  ADD CONSTRAINT FK_KozmuSzamla_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KOZMUSZAMLA 
  ADD CONSTRAINT FK_KozmuSzamla_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_MEROHELY 
  ADD CONSTRAINT FK_Merohely_MukodesiHelyId_REF_MukodesiHely 
  FOREIGN KEY (C_MUKODESIHELYID) 
  REFERENCES [DBO].T_MUKODESIHELY (ID)
GO

ALTER TABLE [DBO].T_MEROHELY 
  ADD CONSTRAINT FK_Merohely_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_MEROHELY 
  ADD CONSTRAINT FK_Merohely_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_KOZMUSZAMLATIPUS 
  ADD CONSTRAINT FK_KozmuSzamlaTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_KOZMUSZAMLATIPUS 
  ADD CONSTRAINT FK_KozmuSzamlaTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KOZMUSZAMLATIPUS 
  ADD CONSTRAINT FK_KozmuSzamlaTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_JELSZOVISSZAALLITAS 
  ADD CONSTRAINT FK_JelszoVisszaallitas_FelhasznaloBelepesId_REF_FelhasznaloBelepes 
  FOREIGN KEY (C_FELHASZNALOBELEPESID) 
  REFERENCES [DBO].T_FELHASZNALOBELEPES (ID)
GO

ALTER TABLE [DBO].T_JELSZOVISSZAALLITAS 
  ADD CONSTRAINT FK_JelszoVisszaallitas_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_JELSZOVISSZAALLITAS 
  ADD CONSTRAINT FK_JelszoVisszaallitas_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_HITTANADATSZOLGALTATAS 
  ADD CONSTRAINT FK_HittanAdatszolgaltatas_OsztalyCsoportId_REF_OsztalyCsoport 
  FOREIGN KEY (C_OSZTALYCSOPORTID) 
  REFERENCES [DBO].T_OSZTALYCSOPORT (ID)
GO

ALTER TABLE [DBO].T_HITTANADATSZOLGALTATAS 
  ADD CONSTRAINT FK_HittanAdatszolgaltatas_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_HITTANADATSZOLGALTATAS 
  ADD CONSTRAINT FK_HittanAdatszolgaltatas_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_HITTANTIPUS 
  ADD CONSTRAINT FK_HittanTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_HITTANTIPUS 
  ADD CONSTRAINT FK_HittanTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_HITTANTIPUS 
  ADD CONSTRAINT FK_HittanTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_HAZIFELADATOK 
  ADD CONSTRAINT FK_HaziFeladatok_TantargyId_REF_Tantargy 
  FOREIGN KEY (C_TANTARGYID) 
  REFERENCES [DBO].T_TANTARGY (ID)
GO

ALTER TABLE [DBO].T_HAZIFELADATOK 
  ADD CONSTRAINT FK_HaziFeladatok_RogzitoId_REF_Felhasznalo 
  FOREIGN KEY (C_ROGZITOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_HAZIFELADATOK 
  ADD CONSTRAINT FK_HaziFeladatok_OsztalyCsoportId_REF_OsztalyCsoport 
  FOREIGN KEY (C_OSZTALYCSOPORTID) 
  REFERENCES [DBO].T_OSZTALYCSOPORT (ID)
GO

ALTER TABLE [DBO].T_HAZIFELADATOK 
  ADD CONSTRAINT FK_HaziFeladatok_TanitasiOraId_REF_TanitasiOra 
  FOREIGN KEY (C_TANITASIORAID) 
  REFERENCES [DBO].T_TANITASIORA (ID)
GO

ALTER TABLE [DBO].T_HAZIFELADATOK 
  ADD CONSTRAINT FK_HaziFeladatok_HelyettesitoId_REF_Felhasznalo 
  FOREIGN KEY (C_HELYETTESITOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_HAZIFELADATOK 
  ADD CONSTRAINT FK_HaziFeladatok_OrarendiOraId_REF_OrarendiOra 
  FOREIGN KEY (C_ORARENDIORAID) 
  REFERENCES [DBO].T_ORARENDIORA (ID)
GO

ALTER TABLE [DBO].T_HAZIFELADATOK 
  ADD CONSTRAINT FK_HaziFeladatok_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_HAZIFELADATOK 
  ADD CONSTRAINT FK_HaziFeladatok_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_VEGZETTSEGTIPUS 
  ADD CONSTRAINT FK_VegzettsegTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_VEGZETTSEGTIPUS 
  ADD CONSTRAINT FK_VegzettsegTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_VEGZETTSEGTIPUS 
  ADD CONSTRAINT FK_VegzettsegTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ELEARNING 
  ADD CONSTRAINT FK_eLearning_FelhasznaloId_REF_Felhasznalo 
  FOREIGN KEY (C_FELHASZNALOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_ELEARNING 
  ADD CONSTRAINT FK_eLearning_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ELEARNING 
  ADD CONSTRAINT FK_eLearning_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_DICTIONARYTYPE 
  ADD CONSTRAINT FK_DictionaryType_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_DICTIONARYTYPE 
  ADD CONSTRAINT FK_DictionaryType_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANULOERTEKELESLATTAMOZAS 
  ADD CONSTRAINT FK_TanuloErtekelesLattamozas_TanuloErtekelesId_REF_TanuloErtekeles 
  FOREIGN KEY (C_TANULOERTEKELESID) 
  REFERENCES [DBO].T_TANULOERTEKELES (ID)
GO

ALTER TABLE [DBO].T_TANULOERTEKELESLATTAMOZAS 
  ADD CONSTRAINT FK_TanuloErtekelesLattamozas_GondviseloId_REF_Gondviselo 
  FOREIGN KEY (C_GONDVISELOID) 
  REFERENCES [DBO].T_GONDVISELO (ID)
GO

ALTER TABLE [DBO].T_TANULOERTEKELESLATTAMOZAS 
  ADD CONSTRAINT FK_TanuloErtekelesLattamozas_LattamozoTanuloId_REF_Tanulo 
  FOREIGN KEY (C_LATTAMOZOTANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_TANULOERTEKELESLATTAMOZAS 
  ADD CONSTRAINT FK_TanuloErtekelesLattamozas_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANULOERTEKELESLATTAMOZAS 
  ADD CONSTRAINT FK_TanuloErtekelesLattamozas_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANULOESEMENYLATTAMOZAS 
  ADD CONSTRAINT FK_TanuloEsemenyLattamozas_GondviseloId_REF_Gondviselo 
  FOREIGN KEY (C_GONDVISELOID) 
  REFERENCES [DBO].T_GONDVISELO (ID)
GO

ALTER TABLE [DBO].T_TANULOESEMENYLATTAMOZAS 
  ADD CONSTRAINT FK_TanuloEsemenyLattamozas_TanuloId_REF_Tanulo 
  FOREIGN KEY (C_TANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_TANULOESEMENYLATTAMOZAS 
  ADD CONSTRAINT FK_TanuloEsemenyLattamozas_TanuloEsemenyId_REF_TanuloEsemeny 
  FOREIGN KEY (C_TANULOESEMENYID) 
  REFERENCES [DBO].T_TANULOESEMENY (ID)
GO

ALTER TABLE [DBO].T_TANULOESEMENYLATTAMOZAS 
  ADD CONSTRAINT FK_TanuloEsemenyLattamozas_LattamozoTanuloId_REF_Tanulo 
  FOREIGN KEY (C_LATTAMOZOTANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_TANULOESEMENYLATTAMOZAS 
  ADD CONSTRAINT FK_TanuloEsemenyLattamozas_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANULOESEMENYLATTAMOZAS 
  ADD CONSTRAINT FK_TanuloEsemenyLattamozas_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANULOMULASZTASLATTAMOZAS 
  ADD CONSTRAINT FK_TanuloMulasztasLattamozas_GondviseloId_REF_Gondviselo 
  FOREIGN KEY (C_GONDVISELOID) 
  REFERENCES [DBO].T_GONDVISELO (ID)
GO

ALTER TABLE [DBO].T_TANULOMULASZTASLATTAMOZAS 
  ADD CONSTRAINT FK_TanuloMulasztasLattamozas_TanuloMulasztasId_REF_TanuloMulasztas 
  FOREIGN KEY (C_TANULOMULASZTASID) 
  REFERENCES [DBO].T_TANULOMULASZTAS (ID)
GO

ALTER TABLE [DBO].T_TANULOMULASZTASLATTAMOZAS 
  ADD CONSTRAINT FK_TanuloMulasztasLattamozas_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANULOMULASZTASLATTAMOZAS 
  ADD CONSTRAINT FK_TanuloMulasztasLattamozas_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ORARENDIORATULAJDONSAG 
  ADD CONSTRAINT FK_OrarendiOraTulajdonsag_OrarendiOraId_REF_OrarendiOra 
  FOREIGN KEY (C_ORARENDIORAID) 
  REFERENCES [DBO].T_ORARENDIORA (ID)
GO

ALTER TABLE [DBO].T_ORARENDIORATULAJDONSAG 
  ADD CONSTRAINT FK_OrarendiOraTulajdonsag_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ORARENDIORATULAJDONSAG 
  ADD CONSTRAINT FK_OrarendiOraTulajdonsag_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ORATULAJDONSAGTIPUS 
  ADD CONSTRAINT FK_OraTulajdonsagTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ORATULAJDONSAGTIPUS 
  ADD CONSTRAINT FK_OraTulajdonsagTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ORATULAJDONSAGTIPUS 
  ADD CONSTRAINT FK_OraTulajdonsagTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANITASIORATULAJDONSAG 
  ADD CONSTRAINT FK_TanitasiOraTulajdonsag_TanitasiOraId_REF_TanitasiOra 
  FOREIGN KEY (C_TANITASIORAID) 
  REFERENCES [DBO].T_TANITASIORA (ID)
GO

ALTER TABLE [DBO].T_TANITASIORATULAJDONSAG 
  ADD CONSTRAINT FK_TanitasiOraTulajdonsag_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANITASIORATULAJDONSAG 
  ADD CONSTRAINT FK_TanitasiOraTulajdonsag_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_NATKERDOIV 
  ADD CONSTRAINT FK_NATKerdoiv_AlkalmazottId_REF_Alkalmazott 
  FOREIGN KEY (C_ALKALMAZOTTID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_NATKERDOIV 
  ADD CONSTRAINT FK_NATKerdoiv_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_NATKERDOIV 
  ADD CONSTRAINT FK_NATKerdoiv_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ERTEKELESMONDATBANK 
  ADD CONSTRAINT FK_ErtekelesMondatbank_TantargyId_REF_Tantargy 
  FOREIGN KEY (C_TANTARGYID) 
  REFERENCES [DBO].T_TANTARGY (ID)
GO

ALTER TABLE [DBO].T_ERTEKELESMONDATBANK 
  ADD CONSTRAINT FK_ErtekelesMondatbank_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ERTEKELESMONDATBANK 
  ADD CONSTRAINT FK_ErtekelesMondatbank_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_KOZOSSEGISZOLGALATTIPUS 
  ADD CONSTRAINT FK_KozossegiSzolgalatTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_KOZOSSEGISZOLGALATTIPUS 
  ADD CONSTRAINT FK_KozossegiSzolgalatTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KOZOSSEGISZOLGALATTIPUS 
  ADD CONSTRAINT FK_KozossegiSzolgalatTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_MUKODESIHELYADATSZOLGALTATAS 
  ADD CONSTRAINT FK_MukodesiHelyAdatszolgaltatas_MukodesiHelyId_REF_MukodesiHely 
  FOREIGN KEY (C_MUKODESIHELYID) 
  REFERENCES [DBO].T_MUKODESIHELY (ID)
GO

ALTER TABLE [DBO].T_MUKODESIHELYADATSZOLGALTATAS 
  ADD CONSTRAINT FK_MukodesiHelyAdatszolgaltatas_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_MUKODESIHELYADATSZOLGALTATAS 
  ADD CONSTRAINT FK_MukodesiHelyAdatszolgaltatas_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_INTEZMENYESZKOZADATSZOLGALTA 
  ADD CONSTRAINT FK_IntezmenyEszkozAdatszolgaltatas_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_INTEZMENYESZKOZADATSZOLGALTA 
  ADD CONSTRAINT FK_IntezmenyEszkozAdatszolgaltatas_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_VEZETOIORASZAMOKTIPUS 
  ADD CONSTRAINT FK_VezetoiOraszamokTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_VEZETOIORASZAMOKTIPUS 
  ADD CONSTRAINT FK_VezetoiOraszamokTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_VEZETOIORASZAMOKTIPUS 
  ADD CONSTRAINT FK_VezetoiOraszamokTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_FOGLALKOZTATASTIPUSA 
  ADD CONSTRAINT FK_FoglalkoztatasTipusa_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_FOGLALKOZTATASTIPUSA 
  ADD CONSTRAINT FK_FoglalkoztatasTipusa_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_FOGLALKOZTATASTIPUSA 
  ADD CONSTRAINT FK_FoglalkoztatasTipusa_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ERETTSEGISZINT 
  ADD CONSTRAINT FK_ErettsegiSzint_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ERETTSEGISZINT 
  ADD CONSTRAINT FK_ErettsegiSzint_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ERETTSEGISZINT 
  ADD CONSTRAINT FK_ErettsegiSzint_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ERETTSEGITIPUS 
  ADD CONSTRAINT FK_ErettsegiTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ERETTSEGITIPUS 
  ADD CONSTRAINT FK_ErettsegiTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ERETTSEGITIPUS 
  ADD CONSTRAINT FK_ErettsegiTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ERETTSEGIEREDMENY 
  ADD CONSTRAINT FK_ErettsegiEredmeny_TanuloId_REF_Tanulo 
  FOREIGN KEY (C_TANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_ERETTSEGIEREDMENY 
  ADD CONSTRAINT FK_ErettsegiEredmeny_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ERETTSEGIEREDMENY 
  ADD CONSTRAINT FK_ErettsegiEredmeny_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ERETTSEGITANTARGYADATOK 
  ADD CONSTRAINT FK_ErettsegiTantargyAdatok_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ERETTSEGITANTARGYADATOK 
  ADD CONSTRAINT FK_ErettsegiTantargyAdatok_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ERETTSEGITANTARGY 
  ADD CONSTRAINT FK_ErettsegiTantargy_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ERETTSEGITANTARGY 
  ADD CONSTRAINT FK_ErettsegiTantargy_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ERETTSEGITANTARGY 
  ADD CONSTRAINT FK_ErettsegiTantargy_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TOVABBIMUNKAUGYIADATOK 
  ADD CONSTRAINT FK_TovabbiMunkaugyiAdatok_AlkalmazottId_REF_Alkalmazott 
  FOREIGN KEY (C_ALKALMAZOTTID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_TOVABBIMUNKAUGYIADATOK 
  ADD CONSTRAINT FK_TovabbiMunkaugyiAdatok_FeladatEllatasiHelyId_REF_FeladatEllatasiHely 
  FOREIGN KEY (C_FELADATELLATASIHELYID) 
  REFERENCES [DBO].T_FELADATELLATASIHELY (ID)
GO

ALTER TABLE [DBO].T_TOVABBIMUNKAUGYIADATOK 
  ADD CONSTRAINT FK_TovabbiMunkaugyiAdatok_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TOVABBIMUNKAUGYIADATOK 
  ADD CONSTRAINT FK_TovabbiMunkaugyiAdatok_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_RESZSZAKKEPESITESTIPUS 
  ADD CONSTRAINT FK_ReszszakkepesitesTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_RESZSZAKKEPESITESTIPUS 
  ADD CONSTRAINT FK_ReszszakkepesitesTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_RESZSZAKKEPESITESTIPUS 
  ADD CONSTRAINT FK_ReszszakkepesitesTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_AGAZATTIPUS 
  ADD CONSTRAINT FK_AgazatTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_AGAZATTIPUS 
  ADD CONSTRAINT FK_AgazatTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_AGAZATTIPUS 
  ADD CONSTRAINT FK_AgazatTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_SZAKMACSOPORTTIPUS 
  ADD CONSTRAINT FK_SzakmacsoportTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_SZAKMACSOPORTTIPUS 
  ADD CONSTRAINT FK_SzakmacsoportTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_SZAKMACSOPORTTIPUS 
  ADD CONSTRAINT FK_SzakmacsoportTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_SZAKKEPESITESTIPUS 
  ADD CONSTRAINT FK_SzakkepesitesTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_SZAKKEPESITESTIPUS 
  ADD CONSTRAINT FK_SzakkepesitesTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_SZAKKEPESITESTIPUS 
  ADD CONSTRAINT FK_SzakkepesitesTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_MUKODESIHELYTIPUS 
  ADD CONSTRAINT FK_MukodesiHelyTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_MUKODESIHELYTIPUS 
  ADD CONSTRAINT FK_MukodesiHelyTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_MUKODESIHELYTIPUS 
  ADD CONSTRAINT FK_MukodesiHelyTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_IKTESZKOZHASZNALATMOD 
  ADD CONSTRAINT FK_IKTEszkozhasznalatMod_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_IKTESZKOZHASZNALATMOD 
  ADD CONSTRAINT FK_IKTEszkozhasznalatMod_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_IKTESZKOZHASZNALATMOD 
  ADD CONSTRAINT FK_IKTEszkozhasznalatMod_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ELSODLEGESIKTESZKOZ 
  ADD CONSTRAINT FK_ElsodlegesIKTEszkoz_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ELSODLEGESIKTESZKOZ 
  ADD CONSTRAINT FK_ElsodlegesIKTEszkoz_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ELSODLEGESIKTESZKOZ 
  ADD CONSTRAINT FK_ElsodlegesIKTEszkoz_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_PEDAGOGUSIKTADATSZOLGALTATAS 
  ADD CONSTRAINT FK_PedagogusIKTAdatszolgaltatas_AlkalmazottId_REF_Alkalmazott 
  FOREIGN KEY (C_ALKALMAZOTTID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_PEDAGOGUSIKTADATSZOLGALTATAS 
  ADD CONSTRAINT FK_PedagogusIKTAdatszolgaltatas_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_PEDAGOGUSIKTADATSZOLGALTATAS 
  ADD CONSTRAINT FK_PedagogusIKTAdatszolgaltatas_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_WIFIELERES 
  ADD CONSTRAINT FK_WiFiEleres_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_WIFIELERES 
  ADD CONSTRAINT FK_WiFiEleres_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_WIFIELERES 
  ADD CONSTRAINT FK_WiFiEleres_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_IKTKOMPETENCIASZINT 
  ADD CONSTRAINT FK_IKTKompetenciaSzint_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_IKTKOMPETENCIASZINT 
  ADD CONSTRAINT FK_IKTKompetenciaSzint_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_IKTKOMPETENCIASZINT 
  ADD CONSTRAINT FK_IKTKompetenciaSzint_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ENAPLOHASZNALAT 
  ADD CONSTRAINT FK_ENaploHasznalat_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ENAPLOHASZNALAT 
  ADD CONSTRAINT FK_ENaploHasznalat_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ENAPLOHASZNALAT 
  ADD CONSTRAINT FK_ENaploHasznalat_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_TAGOZATTIPUS 
  ADD CONSTRAINT FK_TagozatTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_TAGOZATTIPUS 
  ADD CONSTRAINT FK_TagozatTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TAGOZATTIPUS 
  ADD CONSTRAINT FK_TagozatTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_NEBULO 
  ADD CONSTRAINT FK_Nebulo_FeladatEllatasiHelyId_REF_FeladatEllatasiHely 
  FOREIGN KEY (C_FELADATELLATASIHELYID) 
  REFERENCES [DBO].T_FELADATELLATASIHELY (ID)
GO

ALTER TABLE [DBO].T_NEBULO 
  ADD CONSTRAINT FK_Nebulo_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_NEBULO 
  ADD CONSTRAINT FK_Nebulo_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_FELVETELSTATUSZATIPUS 
  ADD CONSTRAINT FK_FelvetelStatuszaTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_FELVETELSTATUSZATIPUS 
  ADD CONSTRAINT FK_FelvetelStatuszaTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_FELVETELSTATUSZATIPUS 
  ADD CONSTRAINT FK_FelvetelStatuszaTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_IDOKERET 
  ADD CONSTRAINT FK_Idokeret_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_IDOKERET 
  ADD CONSTRAINT FK_Idokeret_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_IDOKERET 
  ADD CONSTRAINT FK_Idokeret_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_OSSZEGTULLEPESTIPUS 
  ADD CONSTRAINT FK_OsszegTullepesTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_OSSZEGTULLEPESTIPUS 
  ADD CONSTRAINT FK_OsszegTullepesTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_OSSZEGTULLEPESTIPUS 
  ADD CONSTRAINT FK_OsszegTullepesTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_HIBAJEGYSTATUSZ 
  ADD CONSTRAINT FK_HibajegyStatusz_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_HIBAJEGYSTATUSZ 
  ADD CONSTRAINT FK_HibajegyStatusz_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_HIBAJEGYSTATUSZ 
  ADD CONSTRAINT FK_HibajegyStatusz_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_PRIORITAS 
  ADD CONSTRAINT FK_Prioritas_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_PRIORITAS 
  ADD CONSTRAINT FK_Prioritas_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_PRIORITAS 
  ADD CONSTRAINT FK_Prioritas_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_FORRAS 
  ADD CONSTRAINT FK_Forras_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_FORRAS 
  ADD CONSTRAINT FK_Forras_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_FORRAS 
  ADD CONSTRAINT FK_Forras_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_SZERZODOSZEMELYPOZICIO 
  ADD CONSTRAINT FK_SzerzodoSzemelyPozicio_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_SZERZODOSZEMELYPOZICIO 
  ADD CONSTRAINT FK_SzerzodoSzemelyPozicio_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_SZERZODOSZEMELYPOZICIO 
  ADD CONSTRAINT FK_SzerzodoSzemelyPozicio_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ENAPLOTIPUS 
  ADD CONSTRAINT FK_ENaploTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ENAPLOTIPUS 
  ADD CONSTRAINT FK_ENaploTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ENAPLOTIPUS 
  ADD CONSTRAINT FK_ENaploTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ENAPLOFORRAS 
  ADD CONSTRAINT FK_ENaploForras_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ENAPLOFORRAS 
  ADD CONSTRAINT FK_ENaploForras_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ENAPLOFORRAS 
  ADD CONSTRAINT FK_ENaploForras_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ADATSZOLGALTATASENAPLO 
  ADD CONSTRAINT FK_AdatszolgaltatasENaplo_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ADATSZOLGALTATASENAPLO 
  ADD CONSTRAINT FK_AdatszolgaltatasENaplo_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ENAPLOINFRA 
  ADD CONSTRAINT FK_ENaploInfra_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ENAPLOINFRA 
  ADD CONSTRAINT FK_ENaploInfra_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ENAPLOINFRA 
  ADD CONSTRAINT FK_ENaploInfra_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_NEMKOTOTTMUNKAIDO 
  ADD CONSTRAINT FK_NemKotottMunkaido_TanarId_REF_Alkalmazott 
  FOREIGN KEY (C_TANARID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_NEMKOTOTTMUNKAIDO 
  ADD CONSTRAINT FK_NemKotottMunkaido_TulajdonosId_REF_Felhasznalo 
  FOREIGN KEY (C_TULAJDONOSID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_NEMKOTOTTMUNKAIDO 
  ADD CONSTRAINT FK_NemKotottMunkaido_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_NEMKOTOTTMUNKAIDO 
  ADD CONSTRAINT FK_NemKotottMunkaido_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ESLADAT 
  ADD CONSTRAINT FK_ESLAdat_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ESLADAT 
  ADD CONSTRAINT FK_ESLAdat_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANULOESLADATOK 
  ADD CONSTRAINT FK_TanuloESLAdatok_TanuloId_REF_Tanulo 
  FOREIGN KEY (C_TANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_TANULOESLADATOK 
  ADD CONSTRAINT FK_TanuloESLAdatok_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANULOESLADATOK 
  ADD CONSTRAINT FK_TanuloESLAdatok_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ESLADATTIPUS 
  ADD CONSTRAINT FK_ESLAdatTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ESLADATTIPUS 
  ADD CONSTRAINT FK_ESLAdatTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ESLADATTIPUS 
  ADD CONSTRAINT FK_ESLAdatTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_FOGLALKOZASARCHIV 
  ADD CONSTRAINT FK_FoglalkozasArchiv_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_FOGLALKOZASARCHIV 
  ADD CONSTRAINT FK_FoglalkozasArchiv_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_SOROLASOKATIPUS 
  ADD CONSTRAINT FK_SorolasOkaTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_SOROLASOKATIPUS 
  ADD CONSTRAINT FK_SorolasOkaTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_SOROLASOKATIPUS 
  ADD CONSTRAINT FK_SorolasOkaTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_CSOPORTTIPUS_FOGLALKOZASTIPU 
  ADD CONSTRAINT FK_CsoportTipus_FoglalkozasTipus_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_CSOPORTTIPUS_FOGLALKOZASTIPU 
  ADD CONSTRAINT FK_CsoportTipus_FoglalkozasTipus_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_CSOPORTTIPUS_FOGLALKOZASTIPU 
  ADD CONSTRAINT FK_CsoportTipus_FoglalkozasTipus_CsoportTipusId_REF_CsoportTipus 
  FOREIGN KEY (C_CSOPORTTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [DBO].T_CSOPORTTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_CSOPORTTIPUS_FOGLALKOZASTIPU 
  ADD CONSTRAINT FK_CsoportTipus_FoglalkozasTipus_FoglalkozasTipusId_REF_FoglalkozasTipus 
  FOREIGN KEY (C_FOGLALKOZASTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [DBO].T_FOGLALKOZASTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_KIRTELEPHELY 
  ADD CONSTRAINT FK_KirTelephely_IntezmenyAdatokId_REF_IntezmenyAdatok 
  FOREIGN KEY (C_INTEZMENYADATOKID) 
  REFERENCES [DBO].T_INTEZMENYADATOK (ID)
GO

ALTER TABLE [DBO].T_KIRTELEPHELY 
  ADD CONSTRAINT FK_KirTelephely_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KIRTELEPHELY 
  ADD CONSTRAINT FK_KirTelephely_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_MUNKAIDOKEDVEZMENYOKA 
  ADD CONSTRAINT FK_MunkaidoKedvezmenyOka_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_MUNKAIDOKEDVEZMENYOKA 
  ADD CONSTRAINT FK_MunkaidoKedvezmenyOka_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_MUNKAIDOKEDVEZMENYOKA 
  ADD CONSTRAINT FK_MunkaidoKedvezmenyOka_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_BESOROLASIFOKOZATTIPUS 
  ADD CONSTRAINT FK_BesorolasiFokozatTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_BESOROLASIFOKOZATTIPUS 
  ADD CONSTRAINT FK_BesorolasiFokozatTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_BESOROLASIFOKOZATTIPUS 
  ADD CONSTRAINT FK_BesorolasiFokozatTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_INTEZMENYADATSZOLGALTATAS 
  ADD CONSTRAINT FK_IntezmenyAdatszolgaltatas_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_INTEZMENYADATSZOLGALTATAS 
  ADD CONSTRAINT FK_IntezmenyAdatszolgaltatas_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_INTEZMENYADATSZOLGALTATAS 
  ADD CONSTRAINT FK_IntezmenyAdatszolgaltatas_SzirStatVeglegesitoId_REF_Felhasznalo 
  FOREIGN KEY (C_SZIRSTATVEGLEGESITOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO
ALTER TABLE [DBO].T_PEDAGOGUSSTATUSZ 
  ADD CONSTRAINT FK_PedagogusStatusz_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_PEDAGOGUSSTATUSZ 
  ADD CONSTRAINT FK_PedagogusStatusz_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_PEDAGOGUSSTATUSZ 
  ADD CONSTRAINT FK_PedagogusStatusz_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_KRETATIPUS 
  ADD CONSTRAINT FK_KretaTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_KRETATIPUS 
  ADD CONSTRAINT FK_KretaTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KRETATIPUS 
  ADD CONSTRAINT FK_KretaTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_NAPTARIHET 
  ADD CONSTRAINT FK_NaptariHet_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_NAPTARIHET 
  ADD CONSTRAINT FK_NaptariHet_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_HELYETTESITESIIDOSZAK 
  ADD CONSTRAINT FK_HelyettesitesiIdoszak_RogzitoId_REF_Felhasznalo 
  FOREIGN KEY (C_ROGZITOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_HELYETTESITESIIDOSZAK 
  ADD CONSTRAINT FK_HelyettesitesiIdoszak_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_HELYETTESITESIIDOSZAK 
  ADD CONSTRAINT FK_HelyettesitesiIdoszak_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_HELYETTESITESIIDOSZAK 
  ADD CONSTRAINT FK_HelyettesitesiIdoszak_HelyettesitettOrarendId_REF_OrarendiOra 
  FOREIGN KEY (C_HELYETTESITETTORARENDID) 
  REFERENCES [DBO].T_ORARENDIORA (ID)
GO

ALTER TABLE [DBO].T_HELYETTESITESIIDOSZAK 
  ADD CONSTRAINT FK_HelyettesitesiIdoszak_HelyettesTanarokId_REF_Alkalmazott 
  FOREIGN KEY (C_HELYETTESTANAROKID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_INTEZMENY 
  ADD CONSTRAINT FK_Intezmeny_FenntartoId_REF_Fenntarto 
  FOREIGN KEY (C_FENNTARTOID) 
  REFERENCES [DBO].T_FENNTARTO (ID)
GO

ALTER TABLE [DBO].T_IKTATOTTDOKUMENTUMOK 
  ADD CONSTRAINT FK_IktatottDokumentumok_DokPartnerGondviseloId_REF_Gondviselo 
  FOREIGN KEY (C_DOKPARTNERGONDVISELOID) 
  REFERENCES [DBO].T_GONDVISELO (ID)
GO

ALTER TABLE [DBO].T_IKTATOTTDOKUMENTUMOK 
  ADD CONSTRAINT FK_IktatottDokumentumok_FeltoltoGondviseloId_REF_Gondviselo 
  FOREIGN KEY (C_FELTOLTOGONDVISELOID) 
  REFERENCES [DBO].T_GONDVISELO (ID)
GO

ALTER TABLE [DBO].T_IKTATOTTDOKUMENTUMOK 
  ADD CONSTRAINT FK_IktatottDokumentumok_DokumentumPartnereId_REF_Felhasznalo 
  FOREIGN KEY (C_DOKUMENTUMPARTNEREID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_IKTATOTTDOKUMENTUMOK 
  ADD CONSTRAINT FK_IktatottDokumentumok_FeltoltoFelhasznaloId_REF_Felhasznalo 
  FOREIGN KEY (C_FELTOLTOFELHASZNALOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_IKTATOTTDOKUMENTUMOK 
  ADD CONSTRAINT FK_IktatottDokumentumok_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_IKTATOTTDOKUMENTUMOK 
  ADD CONSTRAINT FK_IktatottDokumentumok_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_JOGOSULTSAG 
  ADD CONSTRAINT FK_Jogosultsag_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_JOGOSULTSAG 
  ADD CONSTRAINT FK_Jogosultsag_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_SZEREPKORTIPUS 
  ADD CONSTRAINT FK_SzerepkorTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_SZEREPKORTIPUS 
  ADD CONSTRAINT FK_SzerepkorTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_SZEREPKORTIPUS 
  ADD CONSTRAINT FK_SzerepkorTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANULOKOZOSSEGISZOLGALAT 
  ADD CONSTRAINT FK_TanuloKozossegiSzolgalat_TanuloId_REF_Tanulo 
  FOREIGN KEY (C_TANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_TANULOKOZOSSEGISZOLGALAT 
  ADD CONSTRAINT FK_TanuloKozossegiSzolgalat_FeljegyzoId_REF_Felhasznalo 
  FOREIGN KEY (C_FELJEGYZOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_TANULOKOZOSSEGISZOLGALAT 
  ADD CONSTRAINT FK_TanuloKozossegiSzolgalat_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANULOKOZOSSEGISZOLGALAT 
  ADD CONSTRAINT FK_TanuloKozossegiSzolgalat_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_RENDSZERERTESITESEK 
  ADD CONSTRAINT FK_RendszerErtesitesek_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_RENDSZERERTESITESEK 
  ADD CONSTRAINT FK_RendszerErtesitesek_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_MUNKAUGYIADATOK 
  ADD CONSTRAINT FK_MunkaugyiAdatok_FeladatEllatasiHelyId_REF_FeladatEllatasiHely 
  FOREIGN KEY (C_FELADATELLATASIHELYID) 
  REFERENCES [DBO].T_FELADATELLATASIHELY (ID)
GO

ALTER TABLE [DBO].T_MUNKAUGYIADATOK 
  ADD CONSTRAINT FK_MunkaugyiAdatok_AlkalmazottId_REF_Alkalmazott 
  FOREIGN KEY (C_ALKALMAZOTTID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_MUNKAUGYIADATOK 
  ADD CONSTRAINT FK_MunkaugyiAdatok_SzervezetId_REF_Szervezet 
  FOREIGN KEY (C_SZERVEZETID) 
  REFERENCES [DBO].T_SZERVEZET (ID)
GO

ALTER TABLE [DBO].T_MUNKAUGYIADATOK 
  ADD CONSTRAINT FK_MunkaugyiAdatok_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_MUNKAUGYIADATOK 
  ADD CONSTRAINT FK_MunkaugyiAdatok_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_SYSTEMSETTINGSCONTROLTYPE 
  ADD CONSTRAINT FK_SystemSettingsControlType_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_SYSTEMSETTINGSCONTROLTYPE 
  ADD CONSTRAINT FK_SystemSettingsControlType_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_SYSTEMSETTINGSCONTROLTYPE 
  ADD CONSTRAINT FK_SystemSettingsControlType_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_MULASZTASSTATISZTIKATIPUS 
  ADD CONSTRAINT FK_MulasztasStatisztikaTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_MULASZTASSTATISZTIKATIPUS 
  ADD CONSTRAINT FK_MulasztasStatisztikaTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_MULASZTASSTATISZTIKATIPUS 
  ADD CONSTRAINT FK_MulasztasStatisztikaTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_OLDALLATOGATOTTSAG 
  ADD CONSTRAINT FK_OldalLatogatottsag_GondviseloId_REF_Gondviselo 
  FOREIGN KEY (C_GONDVISELOID) 
  REFERENCES [DBO].T_GONDVISELO (ID)
GO

ALTER TABLE [DBO].T_OLDALLATOGATOTTSAG 
  ADD CONSTRAINT FK_OldalLatogatottsag_FelhasznaloId_REF_Felhasznalo 
  FOREIGN KEY (C_FELHASZNALOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_OLDALLATOGATOTTSAG 
  ADD CONSTRAINT FK_OldalLatogatottsag_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_OLDALLATOGATOTTSAG 
  ADD CONSTRAINT FK_OldalLatogatottsag_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_FELADATELLATASIHELY 
  ADD CONSTRAINT FK_FeladatEllatasiHely_MukodesiHelyId_REF_MukodesiHely 
  FOREIGN KEY (C_MUKODESIHELYID) 
  REFERENCES [DBO].T_MUKODESIHELY (ID)
GO

ALTER TABLE [DBO].T_FELADATELLATASIHELY 
  ADD CONSTRAINT FK_FeladatEllatasiHely_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_FELADATELLATASIHELY 
  ADD CONSTRAINT FK_FeladatEllatasiHely_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_RENDSZERBEALLITASTIPUS 
  ADD CONSTRAINT FK_RendszerBeallitasTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_RENDSZERBEALLITASTIPUS 
  ADD CONSTRAINT FK_RendszerBeallitasTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_RENDSZERBEALLITASTIPUS 
  ADD CONSTRAINT FK_RendszerBeallitasTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ORATERVTARGY 
  ADD CONSTRAINT FK_OraTervTargy_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ORATERVTARGY 
  ADD CONSTRAINT FK_OraTervTargy_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ORATERVTARGY 
  ADD CONSTRAINT FK_OraTervTargy_OraTervId_REF_OraTerv 
  FOREIGN KEY (C_ORATERVID) 
  REFERENCES [DBO].T_ORATERV (ID)
GO

ALTER TABLE [DBO].T_ORATERVTARGY 
  ADD CONSTRAINT FK_OraTervTargy_TantargyId_REF_Tantargy 
  FOREIGN KEY (C_TANTARGYID) 
  REFERENCES [DBO].T_TANTARGY (ID)
GO

ALTER TABLE [DBO].T_RENDSZERBEALLITAS 
  ADD CONSTRAINT FK_RendszerBeallitas_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_RENDSZERBEALLITAS 
  ADD CONSTRAINT FK_RendszerBeallitas_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ORATERV 
  ADD CONSTRAINT FK_OraTerv_TantervId_REF_Tanterv 
  FOREIGN KEY (C_TANTERVID) 
  REFERENCES [DBO].T_TANTERV (ID)
GO

ALTER TABLE [DBO].T_ORATERV 
  ADD CONSTRAINT FK_OraTerv_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ORATERV 
  ADD CONSTRAINT FK_OraTerv_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_KIZAROCSOPORTTIPUS 
  ADD CONSTRAINT FK_KizaroCsoportTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_KIZAROCSOPORTTIPUS 
  ADD CONSTRAINT FK_KizaroCsoportTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KIZAROCSOPORTTIPUS 
  ADD CONSTRAINT FK_KizaroCsoportTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANARIATLAGSULY 
  ADD CONSTRAINT FK_TanariAtlagSuly_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANARIATLAGSULY 
  ADD CONSTRAINT FK_TanariAtlagSuly_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ERTESITESGENERALASTORTENET 
  ADD CONSTRAINT FK_ErtesitesGeneralasTortenet_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ERTESITESGENERALASTORTENET 
  ADD CONSTRAINT FK_ErtesitesGeneralasTortenet_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ERTESITES 
  ADD CONSTRAINT FK_Ertesites_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ERTESITES 
  ADD CONSTRAINT FK_Ertesites_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ERTESITESTIPUS 
  ADD CONSTRAINT FK_ErtesitesTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ERTESITESTIPUS 
  ADD CONSTRAINT FK_ErtesitesTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ERTESITESTIPUS 
  ADD CONSTRAINT FK_ErtesitesTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ERTESITESSZINTIPUS 
  ADD CONSTRAINT FK_ErtesitesSzinTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ERTESITESSZINTIPUS 
  ADD CONSTRAINT FK_ErtesitesSzinTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ERTESITESSZINTIPUS 
  ADD CONSTRAINT FK_ErtesitesSzinTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_TEVEKENYSEGTIPUS 
  ADD CONSTRAINT FK_TevekenysegTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_TEVEKENYSEGTIPUS 
  ADD CONSTRAINT FK_TevekenysegTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TEVEKENYSEGTIPUS 
  ADD CONSTRAINT FK_TevekenysegTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_PEDAGOGUSELETPALYAMODELL 
  ADD CONSTRAINT FK_PedagogusEletpalyamodell_TanarId_REF_Felhasznalo 
  FOREIGN KEY (C_TANARID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_PEDAGOGUSELETPALYAMODELL 
  ADD CONSTRAINT FK_PedagogusEletpalyamodell_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_PEDAGOGUSELETPALYAMODELL 
  ADD CONSTRAINT FK_PedagogusEletpalyamodell_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ELETPALYAMODELLFOKOZATTIPUS 
  ADD CONSTRAINT FK_EletpalyamodellFokozatTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ELETPALYAMODELLFOKOZATTIPUS 
  ADD CONSTRAINT FK_EletpalyamodellFokozatTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ELETPALYAMODELLFOKOZATTIPUS 
  ADD CONSTRAINT FK_EletpalyamodellFokozatTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ELETPALYAMODELLSTATUSZOK 
  ADD CONSTRAINT FK_EletpalyamodellStatuszok_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ELETPALYAMODELLSTATUSZOK 
  ADD CONSTRAINT FK_EletpalyamodellStatuszok_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ELETPALYAMODELLSTATUSZOK 
  ADD CONSTRAINT FK_EletpalyamodellStatuszok_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANULOMENTESSEG 
  ADD CONSTRAINT FK_TanuloMentesseg_TantargyId_REF_Tantargy 
  FOREIGN KEY (C_TANTARGYID) 
  REFERENCES [DBO].T_TANTARGY (ID)
GO

ALTER TABLE [DBO].T_TANULOMENTESSEG 
  ADD CONSTRAINT FK_TanuloMentesseg_TanuloId_REF_Tanulo 
  FOREIGN KEY (C_TANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_TANULOMENTESSEG 
  ADD CONSTRAINT FK_TanuloMentesseg_FelmentesRogzitoTanarId_REF_Felhasznalo 
  FOREIGN KEY (C_FELMENTESROGZITOTANARID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_TANULOMENTESSEG 
  ADD CONSTRAINT FK_TanuloMentesseg_UtolsoModositoTanarId_REF_Felhasznalo 
  FOREIGN KEY (C_UTOLSOMODOSITOTANARID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_TANULOMENTESSEG 
  ADD CONSTRAINT FK_TanuloMentesseg_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANULOMENTESSEG 
  ADD CONSTRAINT FK_TanuloMentesseg_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_NAPLOELLENORZES 
  ADD CONSTRAINT FK_NaploEllenorzes_OsztalyId_REF_Osztaly 
  FOREIGN KEY (C_OSZTALYID) 
  REFERENCES [DBO].T_OSZTALY (ID)
GO

ALTER TABLE [DBO].T_NAPLOELLENORZES 
  ADD CONSTRAINT FK_NaploEllenorzes_EllenorzoSzemelyId_REF_Felhasznalo 
  FOREIGN KEY (C_ELLENORZOSZEMELYID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_NAPLOELLENORZES 
  ADD CONSTRAINT FK_NaploEllenorzes_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_NAPLOELLENORZES 
  ADD CONSTRAINT FK_NaploEllenorzes_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_IGAZOLAS 
  ADD CONSTRAINT FK_Igazolas_TanuloId_REF_Tanulo 
  FOREIGN KEY (C_TANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_IGAZOLAS 
  ADD CONSTRAINT FK_Igazolas_RogzitoId_REF_Alkalmazott 
  FOREIGN KEY (C_ROGZITOID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_IGAZOLAS 
  ADD CONSTRAINT FK_Igazolas_SzervezetId_REF_Szervezet 
  FOREIGN KEY (C_SZERVEZETID) 
  REFERENCES [DBO].T_SZERVEZET (ID)
GO

ALTER TABLE [DBO].T_IGAZOLAS 
  ADD CONSTRAINT FK_Igazolas_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_IGAZOLAS 
  ADD CONSTRAINT FK_Igazolas_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ORALATOGATAS 
  ADD CONSTRAINT FK_Oralatogatas_ErtekeloId_REF_Alkalmazott 
  FOREIGN KEY (C_ERTEKELOID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_ORALATOGATAS 
  ADD CONSTRAINT FK_Oralatogatas_MegtartottOraId_REF_TanitasiOra 
  FOREIGN KEY (C_MEGTARTOTTORAID) 
  REFERENCES [DBO].T_TANITASIORA (ID)
GO

ALTER TABLE [DBO].T_ORALATOGATAS 
  ADD CONSTRAINT FK_Oralatogatas_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ORALATOGATAS 
  ADD CONSTRAINT FK_Oralatogatas_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_MAGATARTASERTEKELESTIPUS 
  ADD CONSTRAINT FK_MagatartasErtekelesTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_MAGATARTASERTEKELESTIPUS 
  ADD CONSTRAINT FK_MagatartasErtekelesTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_MAGATARTASERTEKELESTIPUS 
  ADD CONSTRAINT FK_MagatartasErtekelesTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_SZORGALOMERTEKELESTIPUS 
  ADD CONSTRAINT FK_SzorgalomErtekelesTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_SZORGALOMERTEKELESTIPUS 
  ADD CONSTRAINT FK_SzorgalomErtekelesTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_SZORGALOMERTEKELESTIPUS 
  ADD CONSTRAINT FK_SzorgalomErtekelesTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANULOESEMENY 
  ADD CONSTRAINT FK_TanuloEsemeny_TantargyId_REF_Tantargy 
  FOREIGN KEY (C_TANTARGYID) 
  REFERENCES [DBO].T_TANTARGY (ID)
GO

ALTER TABLE [DBO].T_TANULOESEMENY 
  ADD CONSTRAINT FK_TanuloEsemeny_TanitasiOraId_REF_TanitasiOra 
  FOREIGN KEY (C_TANITASIORAID) 
  REFERENCES [DBO].T_TANITASIORA (ID)
GO

ALTER TABLE [DBO].T_TANULOESEMENY 
  ADD CONSTRAINT FK_TanuloEsemeny_FeljegyzoId_REF_Felhasznalo 
  FOREIGN KEY (C_FELJEGYZOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_TANULOESEMENY 
  ADD CONSTRAINT FK_TanuloEsemeny_RogziteskoriOsztalyId_REF_Osztaly 
  FOREIGN KEY (C_ROGZITESKORIOSZTALYID) 
  REFERENCES [DBO].T_OSZTALY (ID)
GO

ALTER TABLE [DBO].T_TANULOESEMENY 
  ADD CONSTRAINT FK_TanuloEsemeny_BeirasTanuloId_REF_Tanulo 
  FOREIGN KEY (C_BEIRASTANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_TANULOESEMENY 
  ADD CONSTRAINT FK_TanuloEsemeny_BeirasOsztalycsoportId_REF_OsztalyCsoport 
  FOREIGN KEY (C_BEIRASOSZTALYCSOPORTID) 
  REFERENCES [DBO].T_OSZTALYCSOPORT (ID)
GO

ALTER TABLE [DBO].T_TANULOESEMENY 
  ADD CONSTRAINT FK_TanuloEsemeny_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANULOESEMENY 
  ADD CONSTRAINT FK_TanuloEsemeny_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ESEMENYTIPUS 
  ADD CONSTRAINT FK_EsemenyTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ESEMENYTIPUS 
  ADD CONSTRAINT FK_EsemenyTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ESEMENYTIPUS 
  ADD CONSTRAINT FK_EsemenyTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_IGAZOLASTIPUS 
  ADD CONSTRAINT FK_IgazolasTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_IGAZOLASTIPUS 
  ADD CONSTRAINT FK_IgazolasTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_IGAZOLASTIPUS 
  ADD CONSTRAINT FK_IgazolasTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_CSENGETESIRENDORA 
  ADD CONSTRAINT FK_CsengetesiRendOra_CsengetesiRendId_REF_CsengetesiRend 
  FOREIGN KEY (C_CSENGETESIRENDID) 
  REFERENCES [DBO].T_CSENGETESIREND (ID)
GO

ALTER TABLE [DBO].T_CSENGETESIRENDORA 
  ADD CONSTRAINT FK_CsengetesiRendOra_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_CSENGETESIRENDORA 
  ADD CONSTRAINT FK_CsengetesiRendOra_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_MULASZTASTIPUS 
  ADD CONSTRAINT FK_MulasztasTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_MULASZTASTIPUS 
  ADD CONSTRAINT FK_MulasztasTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_MULASZTASTIPUS 
  ADD CONSTRAINT FK_MulasztasTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANULOMULASZTAS 
  ADD CONSTRAINT FK_TanuloMulasztas_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANULOMULASZTAS 
  ADD CONSTRAINT FK_TanuloMulasztas_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANULOMULASZTAS 
  ADD CONSTRAINT FK_TanuloMulasztas_OraTanuloiId_REF_Tanulo 
  FOREIGN KEY (C_ORATANULOIID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_TANULOMULASZTAS 
  ADD CONSTRAINT FK_TanuloMulasztas_TanitasiOrakId_REF_TanitasiOra 
  FOREIGN KEY (C_TANITASIORAKID) 
  REFERENCES [DBO].T_TANITASIORA (ID)
GO
ALTER TABLE [DBO].T_ERTEKELESMOD 
  ADD CONSTRAINT FK_ErtekelesMod_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ERTEKELESMOD 
  ADD CONSTRAINT FK_ErtekelesMod_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ERTEKELESMOD 
  ADD CONSTRAINT FK_ErtekelesMod_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_OSZTALYZATTIPUS 
  ADD CONSTRAINT FK_OsztalyzatTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_OSZTALYZATTIPUS 
  ADD CONSTRAINT FK_OsztalyzatTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_OSZTALYZATTIPUS 
  ADD CONSTRAINT FK_OsztalyzatTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ERTEKELESTIPUS 
  ADD CONSTRAINT FK_ErtekelesTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ERTEKELESTIPUS 
  ADD CONSTRAINT FK_ErtekelesTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ERTEKELESTIPUS 
  ADD CONSTRAINT FK_ErtekelesTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANULOERTEKELES 
  ADD CONSTRAINT FK_TanuloErtekeles_TantargyId_REF_Tantargy 
  FOREIGN KEY (C_TANTARGYID) 
  REFERENCES [DBO].T_TANTARGY (ID)
GO

ALTER TABLE [DBO].T_TANULOERTEKELES 
  ADD CONSTRAINT FK_TanuloErtekeles_TanuloId_REF_Tanulo 
  FOREIGN KEY (C_TANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_TANULOERTEKELES 
  ADD CONSTRAINT FK_TanuloErtekeles_OsztalyCsoportId_REF_OsztalyCsoport 
  FOREIGN KEY (C_OSZTALYCSOPORTID) 
  REFERENCES [DBO].T_OSZTALYCSOPORT (ID)
GO

ALTER TABLE [DBO].T_TANULOERTEKELES 
  ADD CONSTRAINT FK_TanuloErtekeles_ErtekeloId_REF_Alkalmazott 
  FOREIGN KEY (C_ERTEKELOID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_TANULOERTEKELES 
  ADD CONSTRAINT FK_TanuloErtekeles_TanoraId_REF_TanitasiOra 
  FOREIGN KEY (C_TANORAID) 
  REFERENCES [DBO].T_TANITASIORA (ID)
GO

ALTER TABLE [DBO].T_TANULOERTEKELES 
  ADD CONSTRAINT FK_TanuloErtekeles_OsszefuggoSzakGyakId_REF_OsszefuggoSzakGyak 
  FOREIGN KEY (C_OSSZEFUGGOSZAKGYAKID) 
  REFERENCES [DBO].T_OSSZEFUGGOSZAKGYAK (ID)
GO

ALTER TABLE [DBO].T_TANULOERTEKELES 
  ADD CONSTRAINT FK_TanuloErtekeles_RogziteskoriTanuloOsztalyId_REF_OsztalyCsoport 
  FOREIGN KEY (C_ROGZITESKORITANULOOSZTALYID) 
  REFERENCES [DBO].T_OSZTALYCSOPORT (ID)
GO

ALTER TABLE [DBO].T_TANULOERTEKELES 
  ADD CONSTRAINT FK_TanuloErtekeles_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANULOERTEKELES 
  ADD CONSTRAINT FK_TanuloErtekeles_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANITASIORA 
  ADD CONSTRAINT FK_TanitasiOra_TanmenetId_REF_Tanmenet 
  FOREIGN KEY (C_TANMENETID) 
  REFERENCES [DBO].T_TANMENET (ID)
GO

ALTER TABLE [DBO].T_TANITASIORA 
  ADD CONSTRAINT FK_TanitasiOra_TantargyId_REF_Tantargy 
  FOREIGN KEY (C_TANTARGYID) 
  REFERENCES [DBO].T_TANTARGY (ID)
GO

ALTER TABLE [DBO].T_TANITASIORA 
  ADD CONSTRAINT FK_TanitasiOra_NaptariNapId_REF_NaptariNap 
  FOREIGN KEY (C_NAPTARINAPID) 
  REFERENCES [DBO].T_NAPTARINAP (ID)
GO

ALTER TABLE [DBO].T_TANITASIORA 
  ADD CONSTRAINT FK_TanitasiOra_OrarendiOraId_REF_OrarendiOra 
  FOREIGN KEY (C_ORARENDIORAID) 
  REFERENCES [DBO].T_ORARENDIORA (ID)
GO

ALTER TABLE [DBO].T_TANITASIORA 
  ADD CONSTRAINT FK_TanitasiOra_FoglalkozasId_REF_Foglalkozas 
  FOREIGN KEY (C_FOGLALKOZASID) 
  REFERENCES [DBO].T_FOGLALKOZAS (ID)
GO

ALTER TABLE [DBO].T_TANITASIORA 
  ADD CONSTRAINT FK_TanitasiOra_HelyettesitoTanarId_REF_Alkalmazott 
  FOREIGN KEY (C_HELYETTESITOTANARID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_TANITASIORA 
  ADD CONSTRAINT FK_TanitasiOra_TanarId_REF_Alkalmazott 
  FOREIGN KEY (C_TANARID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_TANITASIORA 
  ADD CONSTRAINT FK_TanitasiOra_TeremId_REF_Terem 
  FOREIGN KEY (C_TEREMID) 
  REFERENCES [DBO].T_TEREM (ID)
GO

ALTER TABLE [DBO].T_TANITASIORA 
  ADD CONSTRAINT FK_TanitasiOra_OsztalyCsoportId_REF_OsztalyCsoport 
  FOREIGN KEY (C_OSZTALYCSOPORTID) 
  REFERENCES [DBO].T_OSZTALYCSOPORT (ID)
GO

ALTER TABLE [DBO].T_TANITASIORA 
  ADD CONSTRAINT FK_TanitasiOra_OraTulajdonosId_REF_Felhasznalo 
  FOREIGN KEY (C_ORATULAJDONOSID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_TANITASIORA 
  ADD CONSTRAINT FK_TanitasiOra_TanulasiEgysegId_REF_TanulasiEgyseg 
  FOREIGN KEY (C_TANULASIEGYSEGID) 
  REFERENCES [DBO].T_TANULASIEGYSEG (ID)
GO

ALTER TABLE [DBO].T_TANITASIORA 
  ADD CONSTRAINT FK_TanitasiOra_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANITASIORA 
  ADD CONSTRAINT FK_TanitasiOra_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_HELYETTESITESTIPUS 
  ADD CONSTRAINT FK_HelyettesitesTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_HELYETTESITESTIPUS 
  ADD CONSTRAINT FK_HelyettesitesTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_HELYETTESITESTIPUS 
  ADD CONSTRAINT FK_HelyettesitesTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_NAPTARINAP 
  ADD CONSTRAINT FK_NaptariNap_AlapCsengetesiRendId_REF_CsengetesiRend 
  FOREIGN KEY (C_ALAPCSENGETESIRENDID) 
  REFERENCES [DBO].T_CSENGETESIREND (ID)
GO

ALTER TABLE [DBO].T_NAPTARINAP 
  ADD CONSTRAINT FK_NaptariNap_AktivCsengetesiRendId_REF_CsengetesiRend 
  FOREIGN KEY (C_AKTIVCSENGETESIRENDID) 
  REFERENCES [DBO].T_CSENGETESIREND (ID)
GO

ALTER TABLE [DBO].T_NAPTARINAP 
  ADD CONSTRAINT FK_NaptariNap_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_NAPTARINAP 
  ADD CONSTRAINT FK_NaptariNap_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANMENET 
  ADD CONSTRAINT FK_Tanmenet_TantargyId_REF_Tantargy 
  FOREIGN KEY (C_TANTARGYID) 
  REFERENCES [DBO].T_TANTARGY (ID)
GO

ALTER TABLE [DBO].T_TANMENET 
  ADD CONSTRAINT FK_Tanmenet_OsztalyCsoportId_REF_OsztalyCsoport 
  FOREIGN KEY (C_OSZTALYCSOPORTID) 
  REFERENCES [DBO].T_OSZTALYCSOPORT (ID)
GO

ALTER TABLE [DBO].T_TANMENET 
  ADD CONSTRAINT FK_Tanmenet_FeltoltoId_REF_Alkalmazott 
  FOREIGN KEY (C_FELTOLTOID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_TANMENET 
  ADD CONSTRAINT FK_Tanmenet_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANMENET 
  ADD CONSTRAINT FK_Tanmenet_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ORARENDIORA 
  ADD CONSTRAINT FK_OrarendiOra_TeremId_REF_Terem 
  FOREIGN KEY (C_TEREMID) 
  REFERENCES [DBO].T_TEREM (ID)
GO

ALTER TABLE [DBO].T_ORARENDIORA 
  ADD CONSTRAINT FK_OrarendiOra_FoglalkozasId_REF_Foglalkozas 
  FOREIGN KEY (C_FOGLALKOZASID) 
  REFERENCES [DBO].T_FOGLALKOZAS (ID)
GO

ALTER TABLE [DBO].T_ORARENDIORA 
  ADD CONSTRAINT FK_OrarendiOra_TantargyId_REF_Tantargy 
  FOREIGN KEY (C_TANTARGYID) 
  REFERENCES [DBO].T_TANTARGY (ID)
GO

ALTER TABLE [DBO].T_ORARENDIORA 
  ADD CONSTRAINT FK_OrarendiOra_OsztalyCsoportId_REF_OsztalyCsoport 
  FOREIGN KEY (C_OSZTALYCSOPORTID) 
  REFERENCES [DBO].T_OSZTALYCSOPORT (ID)
GO

ALTER TABLE [DBO].T_ORARENDIORA 
  ADD CONSTRAINT FK_OrarendiOra_TanarId_REF_Alkalmazott 
  FOREIGN KEY (C_TANARID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_ORARENDIORA 
  ADD CONSTRAINT FK_OrarendiOra_TanevRendjeId_REF_TanevRendje 
  FOREIGN KEY (C_TANEVRENDJEID) 
  REFERENCES [DBO].T_TANEVRENDJE (ID)
GO

ALTER TABLE [DBO].T_ORARENDIORA 
  ADD CONSTRAINT FK_OrarendiOra_OgOrarendId_REF_OgOrarend 
  FOREIGN KEY (C_OGORARENDID) 
  REFERENCES [DBO].T_OGORAREND (ID)
GO

ALTER TABLE [DBO].T_ORARENDIORA 
  ADD CONSTRAINT FK_OrarendiOra_OraTulajdonosId_REF_Felhasznalo 
  FOREIGN KEY (C_ORATULAJDONOSID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_ORARENDIORA 
  ADD CONSTRAINT FK_OrarendiOra_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ORARENDIORA 
  ADD CONSTRAINT FK_OrarendiOra_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANULOCSOPORT 
  ADD CONSTRAINT FK_TanuloCsoport_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANULOCSOPORT 
  ADD CONSTRAINT FK_TanuloCsoport_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANULOCSOPORT 
  ADD CONSTRAINT FK_TanuloCsoport_OsztalyCsoportId_REF_OsztalyCsoport 
  FOREIGN KEY (C_OSZTALYCSOPORTID) 
  REFERENCES [DBO].T_OSZTALYCSOPORT (ID)
GO

ALTER TABLE [DBO].T_TANULOCSOPORT 
  ADD CONSTRAINT FK_TanuloCsoport_TanuloId_REF_Tanulo 
  FOREIGN KEY (C_TANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_CSENGETESIREND 
  ADD CONSTRAINT FK_CsengetesiRend_MukodesiHelyId_REF_MukodesiHely 
  FOREIGN KEY (C_MUKODESIHELYID) 
  REFERENCES [DBO].T_MUKODESIHELY (ID)
GO

ALTER TABLE [DBO].T_CSENGETESIREND 
  ADD CONSTRAINT FK_CsengetesiRend_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_CSENGETESIREND 
  ADD CONSTRAINT FK_CsengetesiRend_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_HETNAPJATIPUS 
  ADD CONSTRAINT FK_HetNapjaTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_HETNAPJATIPUS 
  ADD CONSTRAINT FK_HetNapjaTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_HETNAPJATIPUS 
  ADD CONSTRAINT FK_HetNapjaTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANEVRENDJE 
  ADD CONSTRAINT FK_TanevRendje_CsengetesiRendId_REF_CsengetesiRend 
  FOREIGN KEY (C_CSENGETESIRENDID) 
  REFERENCES [DBO].T_CSENGETESIREND (ID)
GO

ALTER TABLE [DBO].T_TANEVRENDJE 
  ADD CONSTRAINT FK_TanevRendje_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANEVRENDJE 
  ADD CONSTRAINT FK_TanevRendje_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_HETIRENDTIPUS 
  ADD CONSTRAINT FK_HetiRendTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_HETIRENDTIPUS 
  ADD CONSTRAINT FK_HetiRendTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_HETIRENDTIPUS 
  ADD CONSTRAINT FK_HetiRendTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_NAPTIPUS 
  ADD CONSTRAINT FK_NapTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_NAPTIPUS 
  ADD CONSTRAINT FK_NapTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_NAPTIPUS 
  ADD CONSTRAINT FK_NapTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_FOGLALKOZASTIPUS 
  ADD CONSTRAINT FK_FoglalkozasTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_FOGLALKOZASTIPUS 
  ADD CONSTRAINT FK_FoglalkozasTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_FOGLALKOZASTIPUS 
  ADD CONSTRAINT FK_FoglalkozasTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_FOGLALKOZAS 
  ADD CONSTRAINT FK_Foglalkozas_TantargyId_REF_Tantargy 
  FOREIGN KEY (C_TANTARGYID) 
  REFERENCES [DBO].T_TANTARGY (ID)
GO

ALTER TABLE [DBO].T_FOGLALKOZAS 
  ADD CONSTRAINT FK_Foglalkozas_OsztalyCsoportId_REF_OsztalyCsoport 
  FOREIGN KEY (C_OSZTALYCSOPORTID) 
  REFERENCES [DBO].T_OSZTALYCSOPORT (ID)
GO

ALTER TABLE [DBO].T_FOGLALKOZAS 
  ADD CONSTRAINT FK_Foglalkozas_TanarId_REF_Alkalmazott 
  FOREIGN KEY (C_TANARID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_FOGLALKOZAS 
  ADD CONSTRAINT FK_Foglalkozas_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_FOGLALKOZAS 
  ADD CONSTRAINT FK_Foglalkozas_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_TARGYKATEGORIATIPUS 
  ADD CONSTRAINT FK_TargyKategoriaTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_TARGYKATEGORIATIPUS 
  ADD CONSTRAINT FK_TargyKategoriaTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TARGYKATEGORIATIPUS 
  ADD CONSTRAINT FK_TargyKategoriaTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_EVFOLYAMTIPUS 
  ADD CONSTRAINT FK_EvfolyamTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_EVFOLYAMTIPUS 
  ADD CONSTRAINT FK_EvfolyamTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_EVFOLYAMTIPUS 
  ADD CONSTRAINT FK_EvfolyamTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANTARGY 
  ADD CONSTRAINT FK_Tantargy_FotargyId_REF_Tantargy 
  FOREIGN KEY (C_FOTARGYID) 
  REFERENCES [DBO].T_TANTARGY (ID)
GO

ALTER TABLE [DBO].T_TANTARGY 
  ADD CONSTRAINT FK_Tantargy_AMITantargySablonId_REF_AMITantargySablon 
  FOREIGN KEY (C_AMITANTARGYSABLONID) 
  REFERENCES [DBO].T_AMITANTARGYSABLON (ID)
GO

ALTER TABLE [DBO].T_TANTARGY 
  ADD CONSTRAINT FK_Tantargy_SzervezetId_REF_Szervezet 
  FOREIGN KEY (C_SZERVEZETID) 
  REFERENCES [DBO].T_SZERVEZET (ID)
GO

ALTER TABLE [DBO].T_TANTARGY 
  ADD CONSTRAINT FK_Tantargy_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANTARGY 
  ADD CONSTRAINT FK_Tantargy_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANTERV 
  ADD CONSTRAINT FK_Tanterv_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANTERV 
  ADD CONSTRAINT FK_Tanterv_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_OKTATASINEVELESIFELADAT 
  ADD CONSTRAINT FK_OktatasiNevelesiFeladat_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_OKTATASINEVELESIFELADAT 
  ADD CONSTRAINT FK_OktatasiNevelesiFeladat_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_OKTATASINEVELESIFELADAT 
  ADD CONSTRAINT FK_OktatasiNevelesiFeladat_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ERTELMIFOGYATEKOSTIPUS 
  ADD CONSTRAINT FK_ErtelmiFogyatekosTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ERTELMIFOGYATEKOSTIPUS 
  ADD CONSTRAINT FK_ErtelmiFogyatekosTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ERTELMIFOGYATEKOSTIPUS 
  ADD CONSTRAINT FK_ErtelmiFogyatekosTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_HALLASSERULTTIPUS 
  ADD CONSTRAINT FK_HallasserultTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_HALLASSERULTTIPUS 
  ADD CONSTRAINT FK_HallasserultTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_HALLASSERULTTIPUS 
  ADD CONSTRAINT FK_HallasserultTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_LATASSERULTTIPUS 
  ADD CONSTRAINT FK_LatasserultTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_LATASSERULTTIPUS 
  ADD CONSTRAINT FK_LatasserultTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_LATASSERULTTIPUS 
  ADD CONSTRAINT FK_LatasserultTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ETKEZESIKEDVEZMENYTIPUS 
  ADD CONSTRAINT FK_EtkezesiKedvezmenyTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ETKEZESIKEDVEZMENYTIPUS 
  ADD CONSTRAINT FK_EtkezesiKedvezmenyTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ETKEZESIKEDVEZMENYTIPUS 
  ADD CONSTRAINT FK_EtkezesiKedvezmenyTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_HATRANYOSHELYZETTIPUS 
  ADD CONSTRAINT FK_HatranyosHelyzetTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_HATRANYOSHELYZETTIPUS 
  ADD CONSTRAINT FK_HatranyosHelyzetTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_HATRANYOSHELYZETTIPUS 
  ADD CONSTRAINT FK_HatranyosHelyzetTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_VALLAS 
  ADD CONSTRAINT FK_Vallas_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_VALLAS 
  ADD CONSTRAINT FK_Vallas_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_VALLAS 
  ADD CONSTRAINT FK_Vallas_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANEV 
  ADD CONSTRAINT FK_Tanev_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_OSZTALYCSOPORT 
  ADD CONSTRAINT FK_OsztalyCsoport_TeremId_REF_Terem 
  FOREIGN KEY (C_TEREMID) 
  REFERENCES [DBO].T_TEREM (ID)
GO

ALTER TABLE [DBO].T_OSZTALYCSOPORT 
  ADD CONSTRAINT FK_OsztalyCsoport_FeladatEllatasiHelyId_REF_FeladatEllatasiHely 
  FOREIGN KEY (C_FELADATELLATASIHELYID) 
  REFERENCES [DBO].T_FELADATELLATASIHELY (ID)
GO

ALTER TABLE [DBO].T_OSZTALYCSOPORT 
  ADD CONSTRAINT FK_OsztalyCsoport_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_OSZTALYCSOPORT 
  ADD CONSTRAINT FK_OsztalyCsoport_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_OSZTALY 
  ADD CONSTRAINT FK_Osztaly_Id_AlintezmenyId_AltanevId_REF_OsztalyCsoport 
  FOREIGN KEY (ID) 
  REFERENCES [DBO].T_OSZTALYCSOPORT (ID)
GO

ALTER TABLE [DBO].T_OSZTALY 
  ADD CONSTRAINT FK_Osztaly_OsztalyFonokId_REF_Alkalmazott 
  FOREIGN KEY (C_OSZTALYFONOKID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_OSZTALY 
  ADD CONSTRAINT FK_Osztaly_OfoHelyettesId_REF_Alkalmazott 
  FOREIGN KEY (C_OFOHELYETTESID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_OSZTALY 
  ADD CONSTRAINT FK_Osztaly_TantervId_REF_Tanterv 
  FOREIGN KEY (C_TANTERVID) 
  REFERENCES [DBO].T_TANTERV (ID)
GO

ALTER TABLE [DBO].T_OSZTALY 
  ADD CONSTRAINT FK_Osztaly_SZMKKepviseloHelyettesId_REF_Gondviselo 
  FOREIGN KEY (C_SZMKKEPVISELOHELYETTESID) 
  REFERENCES [DBO].T_GONDVISELO (ID)
GO

ALTER TABLE [DBO].T_OSZTALY 
  ADD CONSTRAINT FK_Osztaly_SZMKKepviseloId_REF_Gondviselo 
  FOREIGN KEY (C_SZMKKEPVISELOID) 
  REFERENCES [DBO].T_GONDVISELO (ID)
GO

ALTER TABLE [DBO].T_OSZTALY 
  ADD CONSTRAINT FK_Osztaly_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_OSZTALY 
  ADD CONSTRAINT FK_Osztaly_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_TANTERVIJELLEG 
  ADD CONSTRAINT FK_TanterviJelleg_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_TANTERVIJELLEG 
  ADD CONSTRAINT FK_TanterviJelleg_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANTERVIJELLEG 
  ADD CONSTRAINT FK_TanterviJelleg_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_TESTNEVELESTIPUS 
  ADD CONSTRAINT FK_TestnevelesTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_TESTNEVELESTIPUS 
  ADD CONSTRAINT FK_TestnevelesTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TESTNEVELESTIPUS 
  ADD CONSTRAINT FK_TestnevelesTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ESZKOZJELLEG 
  ADD CONSTRAINT FK_EszkozJelleg_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ESZKOZJELLEG 
  ADD CONSTRAINT FK_EszkozJelleg_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ESZKOZJELLEG 
  ADD CONSTRAINT FK_EszkozJelleg_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_CSOPORT 
  ADD CONSTRAINT FK_Csoport_Id_AlintezmenyId_AltanevId_REF_OsztalyCsoport 
  FOREIGN KEY (ID) 
  REFERENCES [DBO].T_OSZTALYCSOPORT (ID)
GO

ALTER TABLE [DBO].T_CSOPORT 
  ADD CONSTRAINT FK_Csoport_CsoportVezetoId_REF_Alkalmazott 
  FOREIGN KEY (C_CSOPORTVEZETOID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_CSOPORT 
  ADD CONSTRAINT FK_Csoport_OsztalyBontasId_REF_Osztaly 
  FOREIGN KEY (C_OSZTALYBONTASID) 
  REFERENCES [DBO].T_OSZTALY (ID)
GO

ALTER TABLE [DBO].T_CSOPORT 
  ADD CONSTRAINT FK_Csoport_SzervezetId_REF_Szervezet 
  FOREIGN KEY (C_SZERVEZETID) 
  REFERENCES [DBO].T_SZERVEZET (ID)
GO

ALTER TABLE [DBO].T_CSOPORT 
  ADD CONSTRAINT FK_Csoport_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_CSOPORT 
  ADD CONSTRAINT FK_Csoport_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ESZKOZCEL 
  ADD CONSTRAINT FK_EszkozCel_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ESZKOZCEL 
  ADD CONSTRAINT FK_EszkozCel_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ESZKOZCEL 
  ADD CONSTRAINT FK_EszkozCel_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_MERTEKEGYSEGTIPUS 
  ADD CONSTRAINT FK_MertekegysegTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_MERTEKEGYSEGTIPUS 
  ADD CONSTRAINT FK_MertekegysegTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_MERTEKEGYSEGTIPUS 
  ADD CONSTRAINT FK_MertekegysegTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_INTEZMENYADATOK 
  ADD CONSTRAINT FK_IntezmenyAdatok_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_INTEZMENYADATOK 
  ADD CONSTRAINT FK_IntezmenyAdatok_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO
ALTER TABLE [DBO].T_FENNTARTOTIPUS 
  ADD CONSTRAINT FK_FenntartoTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_FENNTARTOTIPUS 
  ADD CONSTRAINT FK_FenntartoTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_FENNTARTOTIPUS 
  ADD CONSTRAINT FK_FenntartoTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_CSOPORTTIPUS 
  ADD CONSTRAINT FK_CsoportTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_CSOPORTTIPUS 
  ADD CONSTRAINT FK_CsoportTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_CSOPORTTIPUS 
  ADD CONSTRAINT FK_CsoportTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ROKONSAGIFOK 
  ADD CONSTRAINT FK_RokonsagiFok_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ROKONSAGIFOK 
  ADD CONSTRAINT FK_RokonsagiFok_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ROKONSAGIFOK 
  ADD CONSTRAINT FK_RokonsagiFok_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_Id_AlintezmenyId_AltanevId_REF_Felhasznalo 
  FOREIGN KEY (ID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_TantervId_REF_Tanterv 
  FOREIGN KEY (C_TANTERVID) 
  REFERENCES [DBO].T_TANTERV (ID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_FelvetelTaneveId_REF_Tanev 
  FOREIGN KEY (C_FELVETELTANEVEID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_MentorId_REF_Alkalmazott 
  FOREIGN KEY (C_MENTORID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TANULO 
  ADD CONSTRAINT FK_Tanulo_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_GONDVISELO 
  ADD CONSTRAINT FK_Gondviselo_TanuloId_REF_Tanulo 
  FOREIGN KEY (C_TANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_GONDVISELO 
  ADD CONSTRAINT FK_Gondviselo_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_GONDVISELO 
  ADD CONSTRAINT FK_Gondviselo_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_MUNKAKORTIPUS 
  ADD CONSTRAINT FK_MunkakorTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_MUNKAKORTIPUS 
  ADD CONSTRAINT FK_MunkakorTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_MUNKAKORTIPUS 
  ADD CONSTRAINT FK_MunkakorTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_MUKODESIHELY 
  ADD CONSTRAINT FK_MukodesiHely_IntezmenyAdatokId_REF_IntezmenyAdatok 
  FOREIGN KEY (C_INTEZMENYADATOKID) 
  REFERENCES [DBO].T_INTEZMENYADATOK (ID)
GO

ALTER TABLE [DBO].T_MUKODESIHELY 
  ADD CONSTRAINT FK_MukodesiHely_TelephelyAnyaintezmenyId_REF_MukodesiHely 
  FOREIGN KEY (C_TELEPHELYANYAINTEZMENYID) 
  REFERENCES [DBO].T_MUKODESIHELY (ID)
GO

ALTER TABLE [DBO].T_MUKODESIHELY 
  ADD CONSTRAINT FK_MukodesiHely_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_MUKODESIHELY 
  ADD CONSTRAINT FK_MukodesiHely_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ALKALMAZOTT 
  ADD CONSTRAINT FK_Alkalmazott_Id_AlintezmenyId_AltanevId_REF_Felhasznalo 
  FOREIGN KEY (ID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_ALKALMAZOTT 
  ADD CONSTRAINT FK_Alkalmazott_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ALKALMAZOTT 
  ADD CONSTRAINT FK_Alkalmazott_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ANYANYELV 
  ADD CONSTRAINT FK_Anyanyelv_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ANYANYELV 
  ADD CONSTRAINT FK_Anyanyelv_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ANYANYELV 
  ADD CONSTRAINT FK_Anyanyelv_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_IGAZOLVANYTIPUS 
  ADD CONSTRAINT FK_IgazolvanyTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_IGAZOLVANYTIPUS 
  ADD CONSTRAINT FK_IgazolvanyTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_IGAZOLVANYTIPUS 
  ADD CONSTRAINT FK_IgazolvanyTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_MUNKAVISZONYTIPUS 
  ADD CONSTRAINT FK_MunkaviszonyTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_MUNKAVISZONYTIPUS 
  ADD CONSTRAINT FK_MunkaviszonyTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_MUNKAVISZONYTIPUS 
  ADD CONSTRAINT FK_MunkaviszonyTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TEREM 
  ADD CONSTRAINT FK_Terem_MukodesiHelyId_REF_MukodesiHely 
  FOREIGN KEY (C_MUKODESIHELYID) 
  REFERENCES [DBO].T_MUKODESIHELY (ID)
GO

ALTER TABLE [DBO].T_TEREM 
  ADD CONSTRAINT FK_Terem_TeremFelelosId_REF_Alkalmazott 
  FOREIGN KEY (C_TEREMFELELOSID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_TEREM 
  ADD CONSTRAINT FK_Terem_SzervezetId_REF_Szervezet 
  FOREIGN KEY (C_SZERVEZETID) 
  REFERENCES [DBO].T_SZERVEZET (ID)
GO

ALTER TABLE [DBO].T_TEREM 
  ADD CONSTRAINT FK_Terem_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TEREM 
  ADD CONSTRAINT FK_Terem_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ESZKOZTIPUS 
  ADD CONSTRAINT FK_EszkozTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ESZKOZTIPUS 
  ADD CONSTRAINT FK_EszkozTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ESZKOZTIPUS 
  ADD CONSTRAINT FK_EszkozTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ESZKOZKATEGORIA 
  ADD CONSTRAINT FK_EszkozKategoria_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ESZKOZKATEGORIA 
  ADD CONSTRAINT FK_EszkozKategoria_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ESZKOZKATEGORIA 
  ADD CONSTRAINT FK_EszkozKategoria_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_ESZKOZ 
  ADD CONSTRAINT FK_Eszkoz_TeremId_REF_Terem 
  FOREIGN KEY (C_TEREMID) 
  REFERENCES [DBO].T_TEREM (ID)
GO

ALTER TABLE [DBO].T_ESZKOZ 
  ADD CONSTRAINT FK_Eszkoz_FelelosId_REF_Alkalmazott 
  FOREIGN KEY (C_FELELOSID) 
  REFERENCES [DBO].T_ALKALMAZOTT (ID)
GO

ALTER TABLE [DBO].T_ESZKOZ 
  ADD CONSTRAINT FK_Eszkoz_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ESZKOZ 
  ADD CONSTRAINT FK_Eszkoz_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_INGYENESTANKONYVELLATAS 
  ADD CONSTRAINT FK_IngyenesTankonyvEllatas_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_INGYENESTANKONYVELLATAS 
  ADD CONSTRAINT FK_IngyenesTankonyvEllatas_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_INGYENESTANKONYVELLATAS 
  ADD CONSTRAINT FK_IngyenesTankonyvEllatas_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_TEREMTIPUS 
  ADD CONSTRAINT FK_TeremTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_TEREMTIPUS 
  ADD CONSTRAINT FK_TeremTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TEREMTIPUS 
  ADD CONSTRAINT FK_TeremTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_MAGANTANULOSAGOKA 
  ADD CONSTRAINT FK_MagantanulosagOka_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_MAGANTANULOSAGOKA 
  ADD CONSTRAINT FK_MagantanulosagOka_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_MAGANTANULOSAGOKA 
  ADD CONSTRAINT FK_MagantanulosagOka_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_FELHASZNALOBELEPES 
  ADD CONSTRAINT FK_FelhasznaloBelepes_FelhasznaloId_REF_Felhasznalo 
  FOREIGN KEY (C_FELHASZNALOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_FELHASZNALOBELEPES 
  ADD CONSTRAINT FK_FelhasznaloBelepes_GondviseloId_REF_Gondviselo 
  FOREIGN KEY (C_GONDVISELOID) 
  REFERENCES [DBO].T_GONDVISELO (ID)
GO

ALTER TABLE [DBO].T_FELHASZNALOBELEPES 
  ADD CONSTRAINT FK_FelhasznaloBelepes_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_FELHASZNALOBELEPES 
  ADD CONSTRAINT FK_FelhasznaloBelepes_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_LOG 
  ADD CONSTRAINT FK_Log_LevelId_REF_LogLevelType 
  FOREIGN KEY (C_LEVELID) 
  REFERENCES [DBO].T_LOGLEVELTYPE (ID)
GO

ALTER TABLE [DBO].T_LOG 
  ADD CONSTRAINT FK_Log_EventTypeId_REF_LogEventType 
  FOREIGN KEY (C_EVENTTYPEID) 
  REFERENCES [DBO].T_LOGEVENTTYPE (ID)
GO

ALTER TABLE [DBO].T_LOG 
  ADD CONSTRAINT FK_Log_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_LOG 
  ADD CONSTRAINT FK_Log_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_MEGYE 
  ADD CONSTRAINT FK_Megye_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_MEGYE 
  ADD CONSTRAINT FK_Megye_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_MEGYE 
  ADD CONSTRAINT FK_Megye_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_FELHASZNALOBELEPESTORTENET 
  ADD CONSTRAINT FK_FelhasznaloBelepesTortenet_FelhasznaloId_REF_Felhasznalo 
  FOREIGN KEY (C_FELHASZNALOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_FELHASZNALOBELEPESTORTENET 
  ADD CONSTRAINT FK_FelhasznaloBelepesTortenet_GondviseloId_REF_Gondviselo 
  FOREIGN KEY (C_GONDVISELOID) 
  REFERENCES [DBO].T_GONDVISELO (ID)
GO

ALTER TABLE [DBO].T_FELHASZNALOBELEPESTORTENET 
  ADD CONSTRAINT FK_FelhasznaloBelepesTortenet_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_FELHASZNALOBELEPESTORTENET 
  ADD CONSTRAINT FK_FelhasznaloBelepesTortenet_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_HONAPOK 
  ADD CONSTRAINT FK_Honapok_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_HONAPOK 
  ADD CONSTRAINT FK_Honapok_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_HONAPOK 
  ADD CONSTRAINT FK_Honapok_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_DIAKIGAZOLVANYIGENYTIPUS 
  ADD CONSTRAINT FK_DiakigazolvanyIgenyTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_DIAKIGAZOLVANYIGENYTIPUS 
  ADD CONSTRAINT FK_DiakigazolvanyIgenyTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_DIAKIGAZOLVANYIGENYTIPUS 
  ADD CONSTRAINT FK_DiakigazolvanyIgenyTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_KOZTERULETJELLEG 
  ADD CONSTRAINT FK_KozteruletJelleg_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_KOZTERULETJELLEG 
  ADD CONSTRAINT FK_KozteruletJelleg_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_KOZTERULETJELLEG 
  ADD CONSTRAINT FK_KozteruletJelleg_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_USERPROFILE 
  ADD CONSTRAINT FK_UserProfile_FelhasznaloId_REF_Felhasznalo 
  FOREIGN KEY (C_FELHASZNALOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_USERPROFILE 
  ADD CONSTRAINT FK_UserProfile_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_USERPROFILE 
  ADD CONSTRAINT FK_UserProfile_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_DIAKIGAZOLVANYIGENYSTATUSZ 
  ADD CONSTRAINT FK_DiakigazolvanyIgenyStatusz_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_DIAKIGAZOLVANYIGENYSTATUSZ 
  ADD CONSTRAINT FK_DiakigazolvanyIgenyStatusz_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_DIAKIGAZOLVANYIGENYSTATUSZ 
  ADD CONSTRAINT FK_DiakigazolvanyIgenyStatusz_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_MUNKAVISZONYJELLEGE 
  ADD CONSTRAINT FK_MunkaviszonyJellege_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_MUNKAVISZONYJELLEGE 
  ADD CONSTRAINT FK_MunkaviszonyJellege_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_MUNKAVISZONYJELLEGE 
  ADD CONSTRAINT FK_MunkaviszonyJellege_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ORSZAGTIPUS 
  ADD CONSTRAINT FK_OrszagTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ORSZAGTIPUS 
  ADD CONSTRAINT FK_OrszagTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ORSZAGTIPUS 
  ADD CONSTRAINT FK_OrszagTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ESEMENYSTATUSZ 
  ADD CONSTRAINT FK_EsemenyStatusz_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ESEMENYSTATUSZ 
  ADD CONSTRAINT FK_EsemenyStatusz_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ESEMENYSTATUSZ 
  ADD CONSTRAINT FK_EsemenyStatusz_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_EMAILTIPUS 
  ADD CONSTRAINT FK_EmailTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_EMAILTIPUS 
  ADD CONSTRAINT FK_EmailTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_EMAILTIPUS 
  ADD CONSTRAINT FK_EmailTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_TELEFONTIPUS 
  ADD CONSTRAINT FK_TelefonTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_TELEFONTIPUS 
  ADD CONSTRAINT FK_TelefonTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TELEFONTIPUS 
  ADD CONSTRAINT FK_TelefonTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_ALLAMPOLGARSAG 
  ADD CONSTRAINT FK_Allampolgarsag_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_ALLAMPOLGARSAG 
  ADD CONSTRAINT FK_Allampolgarsag_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_ALLAMPOLGARSAG 
  ADD CONSTRAINT FK_Allampolgarsag_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_CIMTIPUS 
  ADD CONSTRAINT FK_CimTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_CIMTIPUS 
  ADD CONSTRAINT FK_CimTipus_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_CIMTIPUS 
  ADD CONSTRAINT FK_CimTipus_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
ALTER TABLE [DBO].T_NEM 
  ADD CONSTRAINT FK_Nem_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase 
  FOREIGN KEY (ID, C_ALINTEZMENYID, C_ALTANEVID) 
  REFERENCES [DBO].T_DICTIONARYITEMBASE (ID, C_INTEZMENYID, C_TANEVID)

GO

ALTER TABLE [DBO].T_NEM 
  ADD CONSTRAINT FK_Nem_AlIntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_ALINTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_NEM 
  ADD CONSTRAINT FK_Nem_AlTanevId_REF_Tanev 
  FOREIGN KEY (C_ALTANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_DICTIONARYITEMBASE 
  ADD CONSTRAINT FK_DictionaryItemBase_DictionaryTypeId_REF_DictionaryType 
  FOREIGN KEY (C_DICTIONARYTYPEID) 
  REFERENCES [DBO].T_DICTIONARYTYPE (ID)
GO

ALTER TABLE [DBO].T_DICTIONARYITEMBASE 
  ADD CONSTRAINT FK_DictionaryItemBase_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_DICTIONARYITEMBASE 
  ADD CONSTRAINT FK_DictionaryItemBase_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_TELEFON 
  ADD CONSTRAINT FK_Telefon_GondviseloId_REF_Gondviselo 
  FOREIGN KEY (C_GONDVISELOID) 
  REFERENCES [DBO].T_GONDVISELO (ID)
GO

ALTER TABLE [DBO].T_TELEFON 
  ADD CONSTRAINT FK_Telefon_FelhasznaloId_REF_Felhasznalo 
  FOREIGN KEY (C_FELHASZNALOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_TELEFON 
  ADD CONSTRAINT FK_Telefon_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_TELEFON 
  ADD CONSTRAINT FK_Telefon_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_SZEREPKOR 
  ADD CONSTRAINT FK_Szerepkor_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_SZEREPKOR 
  ADD CONSTRAINT FK_Szerepkor_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_CIM 
  ADD CONSTRAINT FK_Cim_FelhasznaloId_REF_Felhasznalo 
  FOREIGN KEY (C_FELHASZNALOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_CIM 
  ADD CONSTRAINT FK_Cim_GondviseloId_REF_Gondviselo 
  FOREIGN KEY (C_GONDVISELOID) 
  REFERENCES [DBO].T_GONDVISELO (ID)
GO

ALTER TABLE [DBO].T_CIM 
  ADD CONSTRAINT FK_Cim_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_CIM 
  ADD CONSTRAINT FK_Cim_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_EMAIL 
  ADD CONSTRAINT FK_Email_GondviseloId_REF_Gondviselo 
  FOREIGN KEY (C_GONDVISELOID) 
  REFERENCES [DBO].T_GONDVISELO (ID)
GO

ALTER TABLE [DBO].T_EMAIL 
  ADD CONSTRAINT FK_Email_FelhasznaloId_REF_Felhasznalo 
  FOREIGN KEY (C_FELHASZNALOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_EMAIL 
  ADD CONSTRAINT FK_Email_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_EMAIL 
  ADD CONSTRAINT FK_Email_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO

ALTER TABLE [DBO].T_FELHASZNALO 
  ADD CONSTRAINT FK_Felhasznalo_IntezmenyId_REF_Intezmeny 
  FOREIGN KEY (C_INTEZMENYID) 
  REFERENCES [DBO].T_INTEZMENY (ID)
GO

ALTER TABLE [DBO].T_FELHASZNALO 
  ADD CONSTRAINT FK_Felhasznalo_TanevId_REF_Tanev 
  FOREIGN KEY (C_TANEVID) 
  REFERENCES [DBO].T_TANEV (ID)
GO
--/*kapcsoló tábla FK*/

ALTER TABLE [DBO].T_FELTOLTOTTFAJL_MEROALLAS 
  ADD CONSTRAINT FK_FeltoltottFajl_Meroallas_FeltoltottFajlId_REF_FeltoltottFajl 
  FOREIGN KEY (C_FELTOLTOTTFAJLID) 
  REFERENCES [DBO].T_FELTOLTOTTFAJL (ID)
GO

ALTER TABLE [DBO].T_FELTOLTOTTFAJL_MEROALLAS 
  ADD CONSTRAINT FK_FeltoltottFajl_Meroallas_MeroallasId_REF_Meroallas 
  FOREIGN KEY (C_MEROALLASID) 
  REFERENCES [DBO].T_MEROALLAS (ID)
GO

ALTER TABLE [DBO].T_AMIFOTARGY_AMIALTARGY 
  ADD CONSTRAINT FK_AMIFotargy_AMIAltargy_AMIFotargyId_REF_AMITTFSablon 
  FOREIGN KEY (C_AMIFOTARGYID) 
  REFERENCES [DBO].T_AMITTFSABLON (ID)
GO

ALTER TABLE [DBO].T_AMIFOTARGY_AMIALTARGY 
  ADD CONSTRAINT FK_AMIFotargy_AMIAltargy_AMIAltargyId_REF_AMITTFSablon 
  FOREIGN KEY (C_AMIALTARGYID) 
  REFERENCES [DBO].T_AMITTFSABLON (ID)
GO

ALTER TABLE [DBO].T_FELTOLTOTTFAJL_TANITASIORA 
  ADD CONSTRAINT FK_FeltoltottFajl_TanitasiOra_FeltoltottFajlId_REF_FeltoltottFajl 
  FOREIGN KEY (C_FELTOLTOTTFAJLID) 
  REFERENCES [DBO].T_FELTOLTOTTFAJL (ID)
GO

ALTER TABLE [DBO].T_FELTOLTOTTFAJL_TANITASIORA 
  ADD CONSTRAINT FK_FeltoltottFajl_TanitasiOra_TanitasiOraId_REF_TanitasiOra 
  FOREIGN KEY (C_TANITASIORAID) 
  REFERENCES [DBO].T_TANITASIORA (ID)
GO

ALTER TABLE [DBO].T_FELTOLTOTTFAJL_HAZIFELADATOK 
  ADD CONSTRAINT FK_FeltoltottFajl_HaziFeladatok_FeltoltottFajlId_REF_FeltoltottFajl 
  FOREIGN KEY (C_FELTOLTOTTFAJLID) 
  REFERENCES [DBO].T_FELTOLTOTTFAJL (ID)
GO

ALTER TABLE [DBO].T_FELTOLTOTTFAJL_HAZIFELADATOK 
  ADD CONSTRAINT FK_FeltoltottFajl_HaziFeladatok_HaziFeladatokId_REF_HaziFeladatok 
  FOREIGN KEY (C_HAZIFELADATOKID) 
  REFERENCES [DBO].T_HAZIFELADATOK (ID)
GO

ALTER TABLE [DBO].T_FELTOLTOTTFAJL_ORARENDIORA 
  ADD CONSTRAINT FK_FeltoltottFajl_OrarendiOra_FeltoltottFajlId_REF_FeltoltottFajl 
  FOREIGN KEY (C_FELTOLTOTTFAJLID) 
  REFERENCES [DBO].T_FELTOLTOTTFAJL (ID)
GO

ALTER TABLE [DBO].T_FELTOLTOTTFAJL_ORARENDIORA 
  ADD CONSTRAINT FK_FeltoltottFajl_OrarendiOra_OrarendiOraId_REF_OrarendiOra 
  FOREIGN KEY (C_ORARENDIORAID) 
  REFERENCES [DBO].T_ORARENDIORA (ID)
GO

ALTER TABLE [DBO].T_TAVOLLETJELENTO_IKTATOTTDOKU 
  ADD CONSTRAINT FK_TavolletJelento_IktatottDokumentum_TavolletJelentoId_REF_TavolletJelento 
  FOREIGN KEY (C_TAVOLLETJELENTOID) 
  REFERENCES [DBO].T_TAVOLLETJELENTO (ID)
GO

ALTER TABLE [DBO].T_TAVOLLETJELENTO_IKTATOTTDOKU 
  ADD CONSTRAINT FK_TavolletJelento_IktatottDokumentum_IktatottDokumentumId_REF_IktatottDokumentum 
  FOREIGN KEY (C_IKTATOTTDOKUMENTUMID) 
  REFERENCES [DBO].T_IKTATOTTDOKUMENTUM (ID)
GO

ALTER TABLE [DBO].T_KEPESITES_VEGZETTSEG 
  ADD CONSTRAINT FK_Kepesites_Vegzettseg_KepesitesId_REF_Kepesites 
  FOREIGN KEY (C_KEPESITESID) 
  REFERENCES [DBO].T_KEPESITES (ID)
GO

ALTER TABLE [DBO].T_KEPESITES_VEGZETTSEG 
  ADD CONSTRAINT FK_Kepesites_Vegzettseg_VegzettsegId_REF_Vegzettseg 
  FOREIGN KEY (C_VEGZETTSEGID) 
  REFERENCES [DBO].T_VEGZETTSEG (ID)
GO

ALTER TABLE [DBO].T_OSZTALYCSOPORT_TANULOESEMENY 
  ADD CONSTRAINT FK_OsztalyCsoport_TanuloEsemeny_OsztalyCsoportId_REF_OsztalyCsoport 
  FOREIGN KEY (C_OSZTALYCSOPORTID) 
  REFERENCES [DBO].T_OSZTALYCSOPORT (ID)
GO

ALTER TABLE [DBO].T_OSZTALYCSOPORT_TANULOESEMENY 
  ADD CONSTRAINT FK_OsztalyCsoport_TanuloEsemeny_TanuloEsemenyId_REF_TanuloEsemeny 
  FOREIGN KEY (C_TANULOESEMENYID) 
  REFERENCES [DBO].T_TANULOESEMENY (ID)
GO

ALTER TABLE [DBO].T_JOGOSULTFELHASZNALOK_HOZZARE 
  ADD CONSTRAINT FK_JogosultFelhasznalok_HozzarendeltDoksik_JogosultFelhasznalokId_REF_Felhasznalo 
  FOREIGN KEY (C_JOGOSULTFELHASZNALOKID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_JOGOSULTFELHASZNALOK_HOZZARE 
  ADD CONSTRAINT FK_JogosultFelhasznalok_HozzarendeltDoksik_HozzarendeltDoksikId_REF_IktatottDokumentumok 
  FOREIGN KEY (C_HOZZARENDELTDOKSIKID) 
  REFERENCES [DBO].T_IKTATOTTDOKUMENTUMOK (ID)
GO

ALTER TABLE [DBO].T_JOGOSULTSAG_FELHASZNALO 
  ADD CONSTRAINT FK_Jogosultsag_Felhasznalo_JogosultsagId_REF_Jogosultsag 
  FOREIGN KEY (C_JOGOSULTSAGID) 
  REFERENCES [DBO].T_JOGOSULTSAG (ID)
GO

ALTER TABLE [DBO].T_JOGOSULTSAG_FELHASZNALO 
  ADD CONSTRAINT FK_Jogosultsag_Felhasznalo_FelhasznaloId_REF_Felhasznalo 
  FOREIGN KEY (C_FELHASZNALOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_EVFOLYAMTIPUS_OKTATASINEVELE 
  ADD CONSTRAINT FK_EvfolyamTipus_OktatasiNevelesiFeladat_EvfolyamTipusId_REF_EvfolyamTipus 
  FOREIGN KEY (C_EVFOLYAMTIPUSID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [DBO].T_EVFOLYAMTIPUS (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_EVFOLYAMTIPUS_OKTATASINEVELE 
  ADD CONSTRAINT FK_EvfolyamTipus_OktatasiNevelesiFeladat_OktatasiNevelesiFeladatId_REF_OktatasiNevelesiFeladat 
  FOREIGN KEY (C_OKTATASINEVELESIFELADATID, C_INTEZMENYID, C_TANEVID) 
  REFERENCES [DBO].T_OKTATASINEVELESIFELADAT (ID, C_ALINTEZMENYID, C_ALTANEVID)
GO

ALTER TABLE [DBO].T_TANULO_TANULOESEMENY 
  ADD CONSTRAINT FK_Tanulo_TanuloEsemeny_TanuloId_REF_Tanulo 
  FOREIGN KEY (C_TANULOID) 
  REFERENCES [DBO].T_TANULO (ID)
GO

ALTER TABLE [DBO].T_TANULO_TANULOESEMENY 
  ADD CONSTRAINT FK_Tanulo_TanuloEsemeny_TanuloEsemenyId_REF_TanuloEsemeny 
  FOREIGN KEY (C_TANULOESEMENYID) 
  REFERENCES [DBO].T_TANULOESEMENY (ID)
GO

ALTER TABLE [DBO].T_OSZTALYCSOPORT_TANEVRENDJE 
  ADD CONSTRAINT FK_OsztalyCsoport_TanevRendje_OsztalyCsoportId_REF_OsztalyCsoport 
  FOREIGN KEY (C_OSZTALYCSOPORTID) 
  REFERENCES [DBO].T_OSZTALYCSOPORT (ID)
GO

ALTER TABLE [DBO].T_OSZTALYCSOPORT_TANEVRENDJE 
  ADD CONSTRAINT FK_OsztalyCsoport_TanevRendje_TanevRendjeId_REF_TanevRendje 
  FOREIGN KEY (C_TANEVRENDJEID) 
  REFERENCES [DBO].T_TANEVRENDJE (ID)
GO

ALTER TABLE [DBO].T_FELHASZNALO_SZEREPKOR 
  ADD CONSTRAINT FK_Felhasznalo_Szerepkor_FelhasznaloId_REF_Felhasznalo 
  FOREIGN KEY (C_FELHASZNALOID) 
  REFERENCES [DBO].T_FELHASZNALO (ID)
GO

ALTER TABLE [DBO].T_FELHASZNALO_SZEREPKOR 
  ADD CONSTRAINT FK_Felhasznalo_Szerepkor_SzerepkorId_REF_Szerepkor 
  FOREIGN KEY (C_SZEREPKORID) 
  REFERENCES [DBO].T_SZEREPKOR (ID)
GO

--/*Entitások check constraintjei CK*/

--/*Entitások unique constraintjei UK*/
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_AMITANTARGYSABLON' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_AMITantargySablon_Nev_IntezmenyId_TanevId ON T_AMITANTARGYSABLON (C_NEV, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_AMITANTARGYSABLON' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_AMITantargySablon_Nev_AlintezmenyId_AltanevId ON T_AMITANTARGYSABLON (C_NEV, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_AMITantargySablon_Nev ON T_AMITANTARGYSABLON (C_NEV) WHERE TOROLT = 'F'
END
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_DASHBOARDUZENET' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_DashboardUzenet_EgyediAzonosito_IntezmenyId_TanevId ON T_DASHBOARDUZENET (C_EGYEDIAZONOSITO, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_DASHBOARDUZENET' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_DashboardUzenet_EgyediAzonosito_AlintezmenyId_AltanevId ON T_DASHBOARDUZENET (C_EGYEDIAZONOSITO, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_DashboardUzenet_EgyediAzonosito ON T_DASHBOARDUZENET (C_EGYEDIAZONOSITO) WHERE TOROLT = 'F'
END
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_FENNTARTO' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_Fenntarto_Nev_IntezmenyId_TanevId ON T_FENNTARTO (C_NEV, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_FENNTARTO' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_Fenntarto_Nev_AlintezmenyId_AltanevId ON T_FENNTARTO (C_NEV, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_Fenntarto_Nev ON T_FENNTARTO (C_NEV) WHERE TOROLT = 'F'
END
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_FENNTARTO' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_Fenntarto_Azonosito_IntezmenyId_TanevId ON T_FENNTARTO (C_AZONOSITO, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_FENNTARTO' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_Fenntarto_Azonosito_AlintezmenyId_AltanevId ON T_FENNTARTO (C_AZONOSITO, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_Fenntarto_Azonosito ON T_FENNTARTO (C_AZONOSITO) WHERE TOROLT = 'F'
END
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_FENNTARTO' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_Fenntarto_Guid_IntezmenyId_TanevId ON T_FENNTARTO (C_GUID, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_FENNTARTO' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_Fenntarto_Guid_AlintezmenyId_AltanevId ON T_FENNTARTO (C_GUID, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_Fenntarto_Guid ON T_FENNTARTO (C_GUID) WHERE TOROLT = 'F'
END
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_INTEZMENY' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_Intezmeny_Azonosito_IntezmenyId_TanevId ON T_INTEZMENY (C_AZONOSITO, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_INTEZMENY' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_Intezmeny_Azonosito_AlintezmenyId_AltanevId ON T_INTEZMENY (C_AZONOSITO, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_Intezmeny_Azonosito ON T_INTEZMENY (C_AZONOSITO) WHERE TOROLT = 'F'
END
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_CSENGETESIREND' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_CsengetesiRend_Aktiv_Nev_IntezmenyId_TanevId ON T_CSENGETESIREND (C_AKTIV, C_NEV, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_CSENGETESIREND' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_CsengetesiRend_Aktiv_Nev_AlintezmenyId_AltanevId ON T_CSENGETESIREND (C_AKTIV, C_NEV, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_CsengetesiRend_Aktiv_Nev ON T_CSENGETESIREND (C_AKTIV, C_NEV) WHERE TOROLT = 'F'
END
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_TANTARGY' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_Tantargy_Nev_IntezmenyId_TanevId ON T_TANTARGY (C_NEV, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_TANTARGY' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_Tantargy_Nev_AlintezmenyId_AltanevId ON T_TANTARGY (C_NEV, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_Tantargy_Nev ON T_TANTARGY (C_NEV) WHERE TOROLT = 'F'
END
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_TANTERV' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_Tanterv_Nev_IntezmenyId_TanevId ON T_TANTERV (C_NEV, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_TANTERV' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_Tanterv_Nev_AlintezmenyId_AltanevId ON T_TANTERV (C_NEV, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_Tanterv_Nev ON T_TANTERV (C_NEV) WHERE TOROLT = 'F'
END
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_MUKODESIHELY' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_MukodesiHely_Nev_IntezmenyId_TanevId ON T_MUKODESIHELY (C_NEV, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_MUKODESIHELY' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_MukodesiHely_Nev_AlintezmenyId_AltanevId ON T_MUKODESIHELY (C_NEV, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_MukodesiHely_Nev ON T_MUKODESIHELY (C_NEV) WHERE TOROLT = 'F'
END
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_FELHASZNALOBELEPES' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_FelhasznaloBelepes_BejelentkezesiNev_IntezmenyId_TanevId ON T_FELHASZNALOBELEPES (C_BEJELENTKEZESINEV, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_FELHASZNALOBELEPES' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_FelhasznaloBelepes_BejelentkezesiNev_AlintezmenyId_AltanevId ON T_FELHASZNALOBELEPES (C_BEJELENTKEZESINEV, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_FelhasznaloBelepes_BejelentkezesiNev ON T_FELHASZNALOBELEPES (C_BEJELENTKEZESINEV) WHERE TOROLT = 'F'
END
GO
IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_DICTIONARYITEMBASE' AND COLUMN_NAME = 'C_INTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_DictionaryItemBase_Name_Type_IntezmenyId_TanevId ON T_DICTIONARYITEMBASE (C_NAME, C_TYPE, C_INTEZMENYID, C_TANEVID) WHERE TOROLT = 'F'
END
ELSE IF (SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'T_DICTIONARYITEMBASE' AND COLUMN_NAME = 'C_ALINTEZMENYID' ) > 0 BEGIN
  CREATE UNIQUE INDEX NCU_DictionaryItemBase_Name_Type_AlintezmenyId_AltanevId ON T_DICTIONARYITEMBASE (C_NAME, C_TYPE, C_ALINTEZMENYID, C_ALTANEVID) WHERE TOROLT = 'F'
END
ELSE BEGIN
  CREATE UNIQUE INDEX NCU_DictionaryItemBase_Name_Type ON T_DICTIONARYITEMBASE (C_NAME, C_TYPE) WHERE TOROLT = 'F'
END
GO
