﻿GO
SET ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER ON;

SET NUMERIC_ROUNDABORT OFF;


GO
PRINT N'Dropping [dbo].[FK_4025792_4025791]...';


GO
ALTER TABLE [dbo].[T_ORALATOGATAS] DROP CONSTRAINT [FK_4025792_4025791];


GO
PRINT N'Dropping [dbo].[FK_4025945_4025944]...';


GO
ALTER TABLE [dbo].[T_TANARITANTARGY] DROP CONSTRAINT [FK_4025945_4025944];


GO
PRINT N'Dropping [dbo].[FK_4026291_4026289]...';


GO
ALTER TABLE [dbo].[T_HELYETTESITESIIDOSZAK] DROP CONSTRAINT [FK_4026291_4026289];


GO
PRINT N'Dropping [dbo].[FK_4025326_4025325]...';


GO
ALTER TABLE [dbo].[T_CSOPORT] DROP CONSTRAINT [FK_4025326_4025325];


GO
PRINT N'Dropping [dbo].[FK_4027571_4027569]...';


GO
ALTER TABLE [dbo].[T_TOVABBIMUNKAUGYIADATOK] DROP CONSTRAINT [FK_4027571_4027569];


GO
PRINT N'Dropping [dbo].[FK_4025910_4025909]...';


GO
ALTER TABLE [dbo].[T_JOGYAKORLAT] DROP CONSTRAINT [FK_4025910_4025909];


GO
PRINT N'Dropping [dbo].[FK_4025714_4025713]...';


GO
ALTER TABLE [dbo].[T_TANULOESEMENY] DROP CONSTRAINT [FK_4025714_4025713];


GO
PRINT N'Dropping [dbo].[FK_4025633_4025631]...';


GO
ALTER TABLE [dbo].[T_ORAK_TANAROK] DROP CONSTRAINT [FK_4025633_4025631];


GO
PRINT N'Dropping [dbo].[FK_4025437_4025435]...';


GO
ALTER TABLE [dbo].[T_FOGLALKOZASOK_TANAROK] DROP CONSTRAINT [FK_4025437_4025435];


GO
PRINT N'Dropping [dbo].[FK_4026129_4026127]...';


GO
ALTER TABLE [dbo].[T_MUNKAUGYIADATOK] DROP CONSTRAINT [FK_4026129_4026127];


GO
PRINT N'Dropping [dbo].[FK_4027463_4027462]...';


GO
ALTER TABLE [dbo].[T_PEDAGOGUSIKTADATSZOLGALTATAS] DROP CONSTRAINT [FK_4027463_4027462];


GO
PRINT N'Dropping [dbo].[FK_4026685_4026684]...';


GO
ALTER TABLE [dbo].[T_NEMKOTOTTMUNKAIDO] DROP CONSTRAINT [FK_4026685_4026684];


GO
PRINT N'Dropping [dbo].[FK_4025670_4025669]...';


GO
ALTER TABLE [dbo].[T_TANULOERTEKELES] DROP CONSTRAINT [FK_4025670_4025669];


GO
PRINT N'Dropping [dbo].[FK_4025629_4025628]...';


GO
ALTER TABLE [dbo].[T_TANITASIORA] DROP CONSTRAINT [FK_4025629_4025628];


GO
PRINT N'Dropping [dbo].[FK_T_8935_4025165]...';


GO
ALTER TABLE [dbo].[T_ALKALMAZOTT] DROP CONSTRAINT [FK_T_8935_4025165];


GO
PRINT N'Dropping [dbo].[FK_402513902_402513900]...';


GO
ALTER TABLE [dbo].[T_ALKALMAZOTT] DROP CONSTRAINT [FK_402513902_402513900];


GO
PRINT N'Dropping [dbo].[FK_402513905_402513903]...';


GO
ALTER TABLE [dbo].[T_ALKALMAZOTT] DROP CONSTRAINT [FK_402513905_402513903];


GO
PRINT N'Dropping [dbo].[FK_4025850_4025849]...';


GO
ALTER TABLE [dbo].[T_TEVEKENYSEG] DROP CONSTRAINT [FK_4025850_4025849];


GO
PRINT N'Dropping [dbo].[FK_4026131_4026130]...';


GO
ALTER TABLE [dbo].[T_TEREM] DROP CONSTRAINT [FK_4026131_4026130];


GO
PRINT N'Dropping [dbo].[FK_4025605_4025604]...';


GO
ALTER TABLE [dbo].[T_TANMENET] DROP CONSTRAINT [FK_4025605_4025604];


GO
PRINT N'Dropping [dbo].[FK_4026327_4026325]...';


GO
ALTER TABLE [dbo].[T_ORARENDIORA] DROP CONSTRAINT [FK_4026327_4026325];


GO
PRINT N'Dropping [dbo].[FK_4025281_4025280]...';


GO
ALTER TABLE [dbo].[T_ESZKOZ] DROP CONSTRAINT [FK_4025281_4025280];


GO
PRINT N'Dropping [dbo].[FK_4025320_4025319]...';


GO
ALTER TABLE [dbo].[T_OSZTALY] DROP CONSTRAINT [FK_4025320_4025319];


GO
PRINT N'Dropping [dbo].[FK_4025323_4025322]...';


GO
ALTER TABLE [dbo].[T_OSZTALY] DROP CONSTRAINT [FK_4025323_4025322];


GO
PRINT N'Dropping [dbo].[FK_4025761_4025759]...';


GO
ALTER TABLE [dbo].[T_IGAZOLAS] DROP CONSTRAINT [FK_4025761_4025759];


GO
PRINT N'Dropping [dbo].[FK_4026359_4026358]...';


GO
ALTER TABLE [dbo].[T_INTEZMENYADATSZOLGALTATAS] DROP CONSTRAINT [FK_4026359_4026358];


GO
PRINT N'Dropping [dbo].[FK_4026362_4026361]...';


GO
ALTER TABLE [dbo].[T_INTEZMENYADATSZOLGALTATAS] DROP CONSTRAINT [FK_4026362_4026361];


GO
PRINT N'Dropping [dbo].[FK_4025788_4025787]...';


GO
ALTER TABLE [dbo].[T_DIAKIGAZOLVANYIGENYLES] DROP CONSTRAINT [FK_4025788_4025787];


GO
PRINT N'Dropping [dbo].[FK_4027621_4027620]...';


GO
ALTER TABLE [dbo].[T_ERETTSEGIEREDMENY] DROP CONSTRAINT [FK_4027621_4027620];


GO
PRINT N'Dropping [dbo].[FK_4025711_4025710]...';


GO
ALTER TABLE [dbo].[T_TANULO_TANULOESEMENY] DROP CONSTRAINT [FK_4025711_4025710];


GO
PRINT N'Dropping [dbo].[FK_4026179_4026177]...';


GO
ALTER TABLE [dbo].[T_TANULOKOZOSSEGISZOLGALAT] DROP CONSTRAINT [FK_4026179_4026177];


GO
PRINT N'Dropping [dbo].[FK_4025178_4025259]...';


GO
ALTER TABLE [dbo].[T_TANULO] DROP CONSTRAINT [FK_4025178_4025259];


GO
PRINT N'Dropping [dbo].[FK_4025178_4025262]...';


GO
ALTER TABLE [dbo].[T_TANULO] DROP CONSTRAINT [FK_4025178_4025262];


GO
PRINT N'Dropping [dbo].[FK_4025178_4025274]...';


GO
ALTER TABLE [dbo].[T_TANULO] DROP CONSTRAINT [FK_4025178_4025274];


GO
PRINT N'Dropping [dbo].[FK_4025178_4025344]...';


GO
ALTER TABLE [dbo].[T_TANULO] DROP CONSTRAINT [FK_4025178_4025344];


GO
PRINT N'Dropping [dbo].[FK_4025178_4025346]...';


GO
ALTER TABLE [dbo].[T_TANULO] DROP CONSTRAINT [FK_4025178_4025346];


GO
PRINT N'Dropping [dbo].[FK_4025178_4025357]...';


GO
ALTER TABLE [dbo].[T_TANULO] DROP CONSTRAINT [FK_4025178_4025357];


GO
PRINT N'Dropping [dbo].[FK_4025178_4025488]...';


GO
ALTER TABLE [dbo].[T_TANULO] DROP CONSTRAINT [FK_4025178_4025488];


GO
PRINT N'Dropping [dbo].[FK_4025178_4025493]...';


GO
ALTER TABLE [dbo].[T_TANULO] DROP CONSTRAINT [FK_4025178_4025493];


GO
PRINT N'Dropping [dbo].[FK_4025178_4025495]...';


GO
ALTER TABLE [dbo].[T_TANULO] DROP CONSTRAINT [FK_4025178_4025495];


GO
PRINT N'Dropping [dbo].[FK_4025178_4027540]...';


GO
ALTER TABLE [dbo].[T_TANULO] DROP CONSTRAINT [FK_4025178_4027540];


GO
PRINT N'Dropping [dbo].[FK_4025178_4027541]...';


GO
ALTER TABLE [dbo].[T_TANULO] DROP CONSTRAINT [FK_4025178_4027541];


GO
PRINT N'Dropping [dbo].[FK_4025178_4027542]...';


GO
ALTER TABLE [dbo].[T_TANULO] DROP CONSTRAINT [FK_4025178_4027542];


GO
PRINT N'Dropping [dbo].[FK_4025178_4027543]...';


GO
ALTER TABLE [dbo].[T_TANULO] DROP CONSTRAINT [FK_4025178_4027543];


GO
PRINT N'Dropping [dbo].[FK_T_8935_4025190]...';


GO
ALTER TABLE [dbo].[T_TANULO] DROP CONSTRAINT [FK_T_8935_4025190];


GO
PRINT N'Dropping [dbo].[FK_4025416_4025415]...';


GO
ALTER TABLE [dbo].[T_TANULO] DROP CONSTRAINT [FK_4025416_4025415];


GO
PRINT N'Dropping [dbo].[FK_4026237_4026236]...';


GO
ALTER TABLE [dbo].[T_TANULO] DROP CONSTRAINT [FK_4026237_4026236];


GO
PRINT N'Dropping [dbo].[FK_402517802_402517800]...';


GO
ALTER TABLE [dbo].[T_TANULO] DROP CONSTRAINT [FK_402517802_402517800];


GO
PRINT N'Dropping [dbo].[FK_402517805_402517803]...';


GO
ALTER TABLE [dbo].[T_TANULO] DROP CONSTRAINT [FK_402517805_402517803];


GO
PRINT N'Dropping [dbo].[FK_4025673_4025672]...';


GO
ALTER TABLE [dbo].[T_TANULOMULASZTAS] DROP CONSTRAINT [FK_4025673_4025672];


GO
PRINT N'Dropping [dbo].[FK_4025181_4025180]...';


GO
ALTER TABLE [dbo].[T_GONDVISELO] DROP CONSTRAINT [FK_4025181_4025180];


GO
PRINT N'Dropping [dbo].[FK_4025665_4025663]...';


GO
ALTER TABLE [dbo].[T_TANULOERTEKELES] DROP CONSTRAINT [FK_4025665_4025663];


GO
PRINT N'Dropping [dbo].[FK_4026674_4026673]...';


GO
ALTER TABLE [dbo].[T_TANULOESLADATOK] DROP CONSTRAINT [FK_4026674_4026673];


GO
PRINT N'Dropping [dbo].[FK_4026076_4026075]...';


GO
ALTER TABLE [dbo].[T_TANULOTARGYMULASZTASSTATISZT] DROP CONSTRAINT [FK_4026076_4026075];


GO
PRINT N'Dropping [dbo].[FK_4026073_4026072]...';


GO
ALTER TABLE [dbo].[T_TANULOMULASZTASSTATISZTIKA] DROP CONSTRAINT [FK_4026073_4026072];


GO
PRINT N'Dropping [dbo].[FK_4025780_4025778]...';


GO
ALTER TABLE [dbo].[T_TANULOMENTESSEG] DROP CONSTRAINT [FK_4025780_4025778];


GO
PRINT N'Dropping [dbo].[FK_4025527_4025525]...';


GO
ALTER TABLE [dbo].[T_TANULOCSOPORT] DROP CONSTRAINT [FK_4025527_4025525];


GO
PRINT N'Dropping [dbo].[FK_4025758_4025756]...';


GO
ALTER TABLE [dbo].[T_IGAZOLAS] DROP CONSTRAINT [FK_4025758_4025756];


GO
PRINT N'Starting rebuilding table [dbo].[T_ALKALMAZOTT]...';


GO
BEGIN TRANSACTION;

SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;

SET XACT_ABORT ON;

CREATE TABLE [dbo].[tmp_ms_xx_T_ALKALMAZOTT] (
    [ID]                             INT      NOT NULL,
    [C_ALLANDOHELYETTESITESRE]       CHAR (1) DEFAULT ('F') NULL,
    [C_FOALLAS]                      CHAR (1) DEFAULT ('T') NOT NULL,
    [C_TANARIAUTOMATAMEGAJANLASENGE] CHAR (1) NULL,
    [C_TANARIERTEKELESHATARERTEK]    INT      NULL,
    [C_DIAKOLIMPIA]                  CHAR (1) DEFAULT ('F') NULL,
    [C_SZAKERTOIVIZSGAELNOKI]        CHAR (1) DEFAULT ('F') NULL,
    [C_SZAKVIZSGA]                   CHAR (1) DEFAULT ('F') NULL,
    [C_TOVABBKEPZES]                 CHAR (1) DEFAULT ('F') NULL,
    [C_ALINTEZMENYID]                INT      NOT NULL,
    [C_ALTANEVID]                    INT      NOT NULL,
    [TOROLT]                         CHAR (1) DEFAULT ('F') NULL,
    [SERIAL]                         INT      NULL,
    [LASTCHANGED]                    DATETIME DEFAULT (getdate()) NULL,
    [CREATED]                        DATETIME DEFAULT (getdate()) NULL,
    [MODIFIER]                       INT      NULL,
    [CREATOR]                        INT      NULL,
    CONSTRAINT [tmp_ms_xx_constraint_PK_T_40251391] PRIMARY KEY CLUSTERED ([ID] ASC)
);

IF EXISTS (SELECT TOP 1 1 
           FROM   [dbo].[T_ALKALMAZOTT])
    BEGIN
        INSERT INTO [dbo].[tmp_ms_xx_T_ALKALMAZOTT] ([ID], [C_ALLANDOHELYETTESITESRE], [C_FOALLAS], [C_TANARIAUTOMATAMEGAJANLASENGE], [C_TANARIERTEKELESHATARERTEK], [C_DIAKOLIMPIA], [C_ALINTEZMENYID], [C_ALTANEVID], [TOROLT], [SERIAL], [LASTCHANGED], [CREATED], [MODIFIER], [CREATOR])
        SELECT   [ID],
                 [C_ALLANDOHELYETTESITESRE],
                 [C_FOALLAS],
                 [C_TANARIAUTOMATAMEGAJANLASENGE],
                 [C_TANARIERTEKELESHATARERTEK],
                 [C_DIAKOLIMPIA],
                 [C_ALINTEZMENYID],
                 [C_ALTANEVID],
                 [TOROLT],
                 [SERIAL],
                 [LASTCHANGED],
                 [CREATED],
                 [MODIFIER],
                 [CREATOR]
        FROM     [dbo].[T_ALKALMAZOTT]
        ORDER BY [ID] ASC;
    END

DROP TABLE [dbo].[T_ALKALMAZOTT];

EXECUTE sp_rename N'[dbo].[tmp_ms_xx_T_ALKALMAZOTT]', N'T_ALKALMAZOTT';

EXECUTE sp_rename N'[dbo].[tmp_ms_xx_constraint_PK_T_40251391]', N'PK_T_4025139', N'OBJECT';

COMMIT TRANSACTION;

SET TRANSACTION ISOLATION LEVEL READ COMMITTED;


GO
PRINT N'Creating [dbo].[T_ALKALMAZOTT].[I_T_402513902_402513900]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402513902_402513900]
    ON [dbo].[T_ALKALMAZOTT]([C_ALINTEZMENYID] ASC);


GO
PRINT N'Creating [dbo].[T_ALKALMAZOTT].[I_T_402513905_402513903]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402513905_402513903]
    ON [dbo].[T_ALKALMAZOTT]([C_ALTANEVID] ASC);


GO
PRINT N'Starting rebuilding table [dbo].[T_INTEZMENYADATSZOLGALTATAS]...';


GO
BEGIN TRANSACTION;

SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;

SET XACT_ABORT ON;

CREATE TABLE [dbo].[tmp_ms_xx_T_INTEZMENYADATSZOLGALTATAS] (
    [ID]                          INT            IDENTITY (1, 1) NOT NULL,
    [C_ELFOGADOTTESL]             CHAR (1)       NULL,
    [C_ELFOGADOTTTTF]             CHAR (1)       NULL,
    [C_VEGLEGESESL]               CHAR (1)       NULL,
    [C_VEGLEGESTTF]               CHAR (1)       NULL,
    [C_FENNTARTOTTFELUTASITASOKA] NVARCHAR (MAX) NULL,
    [C_ELFOGADOTTESLDATUMA]       DATETIME       NULL,
    [C_ELFOGADOTTLETSZAM]         CHAR (1)       NULL,
    [C_ELFOGADOTTLETSZAMDATUMA]   DATETIME       NULL,
    [C_ELFOGADOTTTTFDATUMA]       DATETIME       NULL,
    [C_FENNTARTOESLELUTASITASOKA] NVARCHAR (MAX) NULL,
    [C_VEGLEGESESLDATUMA]         DATETIME       NULL,
    [C_VEGLEGESLETSZAM]           CHAR (1)       NULL,
    [C_VEGLEGESLETSZAMDATUMA]     DATETIME       NULL,
    [C_VEGLEGESTTFDATUMA]         DATETIME       NULL,
    [C_BEIRATKOZASELUTASITASOKA]  NVARCHAR (MAX) NULL,
    [C_ELFOGADOTTBEIRATKOZAS]     CHAR (1)       NULL,
    [C_VEGLEGESBEIRATKOZAS]       CHAR (1)       DEFAULT ('F') NULL,
    [C_SZAKBEIRATKFELVETT]        INT            NULL,
    [C_SZAKBEIRATKJELENTKEZETT]   INT            NULL,
    [C_INTEZMENYID]               INT            NOT NULL,
    [C_TANEVID]                   INT            NOT NULL,
    [TOROLT]                      CHAR (1)       DEFAULT ('F') NULL,
    [SERIAL]                      INT            NULL,
    [LASTCHANGED]                 DATETIME       DEFAULT (getdate()) NULL,
    [CREATED]                     DATETIME       DEFAULT (getdate()) NULL,
    [MODIFIER]                    INT            NULL,
    [CREATOR]                     INT            NULL,
    CONSTRAINT [tmp_ms_xx_constraint_PK_T_40263461] PRIMARY KEY CLUSTERED ([ID] ASC)
);

IF EXISTS (SELECT TOP 1 1 
           FROM   [dbo].[T_INTEZMENYADATSZOLGALTATAS])
    BEGIN
        SET IDENTITY_INSERT [dbo].[tmp_ms_xx_T_INTEZMENYADATSZOLGALTATAS] ON;
        INSERT INTO [dbo].[tmp_ms_xx_T_INTEZMENYADATSZOLGALTATAS] ([ID], [C_ELFOGADOTTESL], [C_ELFOGADOTTTTF], [C_VEGLEGESESL], [C_VEGLEGESTTF], [C_FENNTARTOTTFELUTASITASOKA], [C_ELFOGADOTTESLDATUMA], [C_ELFOGADOTTLETSZAM], [C_ELFOGADOTTLETSZAMDATUMA], [C_ELFOGADOTTTTFDATUMA], [C_FENNTARTOESLELUTASITASOKA], [C_VEGLEGESESLDATUMA], [C_VEGLEGESLETSZAM], [C_VEGLEGESLETSZAMDATUMA], [C_VEGLEGESTTFDATUMA], [C_BEIRATKOZASELUTASITASOKA], [C_ELFOGADOTTBEIRATKOZAS], [C_VEGLEGESBEIRATKOZAS], [C_INTEZMENYID], [C_TANEVID], [TOROLT], [SERIAL], [LASTCHANGED], [CREATED], [MODIFIER], [CREATOR])
        SELECT   [ID],
                 [C_ELFOGADOTTESL],
                 [C_ELFOGADOTTTTF],
                 [C_VEGLEGESESL],
                 [C_VEGLEGESTTF],
                 [C_FENNTARTOTTFELUTASITASOKA],
                 [C_ELFOGADOTTESLDATUMA],
                 [C_ELFOGADOTTLETSZAM],
                 [C_ELFOGADOTTLETSZAMDATUMA],
                 [C_ELFOGADOTTTTFDATUMA],
                 [C_FENNTARTOESLELUTASITASOKA],
                 [C_VEGLEGESESLDATUMA],
                 [C_VEGLEGESLETSZAM],
                 [C_VEGLEGESLETSZAMDATUMA],
                 [C_VEGLEGESTTFDATUMA],
                 [C_BEIRATKOZASELUTASITASOKA],
                 [C_ELFOGADOTTBEIRATKOZAS],
                 [C_VEGLEGESBEIRATKOZAS],
                 [C_INTEZMENYID],
                 [C_TANEVID],
                 [TOROLT],
                 [SERIAL],
                 [LASTCHANGED],
                 [CREATED],
                 [MODIFIER],
                 [CREATOR]
        FROM     [dbo].[T_INTEZMENYADATSZOLGALTATAS]
        ORDER BY [ID] ASC;
        SET IDENTITY_INSERT [dbo].[tmp_ms_xx_T_INTEZMENYADATSZOLGALTATAS] OFF;
    END

DROP TABLE [dbo].[T_INTEZMENYADATSZOLGALTATAS];

EXECUTE sp_rename N'[dbo].[tmp_ms_xx_T_INTEZMENYADATSZOLGALTATAS]', N'T_INTEZMENYADATSZOLGALTATAS';

EXECUTE sp_rename N'[dbo].[tmp_ms_xx_constraint_PK_T_40263461]', N'PK_T_4026346', N'OBJECT';

COMMIT TRANSACTION;

SET TRANSACTION ISOLATION LEVEL READ COMMITTED;


GO
PRINT N'Creating [dbo].[T_INTEZMENYADATSZOLGALTATAS].[I_T_4026359_4026358]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4026359_4026358]
    ON [dbo].[T_INTEZMENYADATSZOLGALTATAS]([C_INTEZMENYID] ASC);


GO
PRINT N'Creating [dbo].[T_INTEZMENYADATSZOLGALTATAS].[I_T_4026362_4026361]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4026362_4026361]
    ON [dbo].[T_INTEZMENYADATSZOLGALTATAS]([C_TANEVID] ASC);


GO
PRINT N'Starting rebuilding table [dbo].[T_TANULO]...';


GO
BEGIN TRANSACTION;

SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;

SET XACT_ABORT ON;

CREATE TABLE [dbo].[tmp_ms_xx_T_TANULO] (
    [ID]                             INT             NOT NULL,
    [C_ALLAMIGONDOZOTT]              CHAR (1)        NULL,
    [C_BANKSZAMLASZAM]               NVARCHAR (24)   NULL,
    [C_BEILLESZKEDESINEHEZSEG]       CHAR (1)        NULL,
    [C_BEIRASINAPLOSORSZAM]          NVARCHAR (50)   NULL,
    [C_BEJARO]                       CHAR (1)        NULL,
    [C_DIAKIGAZOLVANYKELTE]          DATETIME        NULL,
    [C_DIAKIGAZOLVANYSZAM]           NVARCHAR (255)  NULL,
    [C_ELOZOINTEZMENY]               NVARCHAR (255)  NULL,
    [C_EVISMETLO]                    CHAR (1)        NULL,
    [C_INGYENESTANKONVYELLATASA]     INT             NULL,
    [C_JOGVISZONYATSZUNETELTETO]     CHAR (1)        NULL,
    [C_MAGANTANULO]                  CHAR (1)        NULL,
    [C_MAGANTANULOSAGANAKOKA]        INT             NULL,
    [C_MAGANTANULOSAGKEZDETE]        DATETIME        NULL,
    [C_NAPLOSORSZAM]                 INT             NULL,
    [C_POLGARISZERZODESES]           CHAR (1)        NULL,
    [C_SZAKMAIGYAKORLATON]           CHAR (1)        NULL,
    [C_SZOCIALISTAMOGATAS]           CHAR (1)        NULL,
    [C_TANDIJATFIZETO]               CHAR (1)        NULL,
    [C_TANKOTELEZETT]                CHAR (1)        NULL,
    [C_TANKOTELEZETTSEGVEGE]         DATETIME        NULL,
    [C_TANULOSZERZODESES]            CHAR (1)        NULL,
    [C_TERITESIDIJATFIZETO]          CHAR (1)        NULL,
    [C_TESTNEVELESTIPUSA]            INT             NULL,
    [C_VENDEG]                       CHAR (1)        NULL,
    [C_BTMPROBLEMAS]                 CHAR (1)        DEFAULT ('F') NULL,
    [C_DIAKSPORTKOROS]               CHAR (1)        NULL,
    [C_EGYHAZKOZOSSEGE]              NVARCHAR (255)  NULL,
    [C_ETKEZESIKEDVEZMENY]           INT             NULL,
    [C_HALMOZOTTANFOGYATEKOS]        CHAR (1)        DEFAULT ('F') NULL,
    [C_HATRANYOSHELYZETU]            INT             NULL,
    [C_KOLLEGIUMIELLATASOS]          CHAR (1)        DEFAULT ('F') NULL,
    [C_RENDSZERESGYERMEKVEDELMIKEDV] NVARCHAR (255)  NULL,
    [C_SAJATOSNEVELESU]              CHAR (1)        DEFAULT ('F') NULL,
    [C_SPORTAG]                      NVARCHAR (255)  NULL,
    [C_SPORTEDZONEVE]                NVARCHAR (1000) NULL,
    [C_SPORTKLUB]                    NVARCHAR (100)  NULL,
    [C_SZAKKEPESITESSZAMA]           INT             NULL,
    [C_TANULOIJOGVISZONYOSELTARTOTT] INT             NULL,
    [C_TARTOSGYOGYKEZELESSZAMA]      NVARCHAR (255)  NULL,
    [C_TOBBGYERMEKIGAZOLASSZAMA]     NVARCHAR (255)  NULL,
    [C_VALLASA]                      INT             NULL,
    [C_VESZELYEZTETETT]              CHAR (1)        DEFAULT ('F') NULL,
    [C_JOGVISZONYVARHATOBEFEJEZESE]  DATETIME        NULL,
    [C_BEILLESZKEDESIPROBLEMAVALKUZ] CHAR (1)        NULL,
    [C_BESZEDFOGYATEKOSOKMANYSZAM]   NVARCHAR (100)  NULL,
    [C_BNOKOD]                       NVARCHAR (100)  NULL,
    [C_BTMHATAROZATOKMANYSZAM]       NVARCHAR (255)  NULL,
    [C_BTMHATAROZATTARTALMA]         NVARCHAR (1000) NULL,
    [C_BTMKIALLITOINTEZMENY]         NVARCHAR (255)  NULL,
    [C_BTMKONTROLLIDOPONT]           DATETIME        NULL,
    [C_BTMLETSZAMSULY]               NUMERIC (10, 2) NULL,
    [C_BTMOKMANYERVENYESSEGKEZDETE]  DATETIME        NULL,
    [C_BTMOKMANYERVENYESSEGVEGE]     DATETIME        NULL,
    [C_DISZGRAFIAOKMANYSZAM]         NVARCHAR (100)  NULL,
    [C_DISZKALKULIAOKMANYSZAM]       NVARCHAR (255)  NULL,
    [C_DISZLEXIAOKMANYSZAM]          NVARCHAR (255)  NULL,
    [C_ERTELMIFOGYATEKOS]            INT             NULL,
    [C_ERTELMIFOGYATEKOSOKMANYSZAM]  NVARCHAR (30)   NULL,
    [C_FEJLESZTESREKIJELOLT]         NVARCHAR (255)  NULL,
    [C_FEJLESZTOFOGLALKOZAS]         NVARCHAR (255)  NULL,
    [C_FEJLESZTOFOGLALKOZASORASZAM]  NUMERIC (10, 2) NULL,
    [C_HALLASSERULT]                 INT             NULL,
    [C_HALLASSERULTOKMANYSZAM]       NVARCHAR (100)  NULL,
    [C_LATASSERULT]                  INT             NULL,
    [C_LATASSERULTOKMANYSZAM]        NVARCHAR (100)  NULL,
    [C_MAGATARTASIPROBLEMAVALKUZD]   CHAR (1)        NULL,
    [C_MEGISMERONEMORGANIKUSOKMANYS] NVARCHAR (100)  NULL,
    [C_MEGISMEROORGANIKUSOKMANYSZAM] NVARCHAR (100)  NULL,
    [C_MOZGASSERULTOKMANYSZAM]       NVARCHAR (255)  NULL,
    [C_SNIKIALLITOINTEZMENY]         NVARCHAR (255)  NULL,
    [C_SNIKONTROLLIDOPONT]           DATETIME        NULL,
    [C_SNILETSZAMSULY]               NUMERIC (10, 2) NULL,
    [C_SNIMEGHATAROZAS]              NVARCHAR (255)  NULL,
    [C_SNIOKMANYERVENYESSEGKEZDETE]  DATETIME        NULL,
    [C_SNIOKMANYERVENYESSEGVEGE]     DATETIME        NULL,
    [C_TANULASIPROBLEMADISZGRAFIA]   CHAR (1)        NULL,
    [C_TANULASIPROBLEMAVALKUZD]      CHAR (1)        NULL,
    [C_TANULASIPROBLEMAVALKUZDDISZK] CHAR (1)        NULL,
    [C_TANULASIPROBLEMAVALKUZDDISZL] CHAR (1)        NULL,
    [C_VISELKEDESNEMORGANIKUSOKMANY] NVARCHAR (100)  NULL,
    [C_VISELKEDESORGANIKUSOKMANYSZA] NVARCHAR (100)  NULL,
    [C_ELSOINTEZMENYOMKOD]           NVARCHAR (12)   NULL,
    [C_EVISMETLOTANTARGYAK]          NVARCHAR (1000) NULL,
    [C_KOZEPFOKUOKTATASBATIZENHATOD] CHAR (1)        NULL,
    [C_MENEDEKJOGGALRENDELKEZO]      CHAR (1)        NULL,
    [C_AGAZAT]                       INT             NULL,
    [C_RESZSZAKKEPESITES]            INT             NULL,
    [C_SZAKKEPESITES]                INT             NULL,
    [C_SZAKMACSOPORT]                INT             NULL,
    [C_EGYEBDONTO]                   CHAR (1)        DEFAULT ('F') NULL,
    [C_MEGALLAPODASOS]               CHAR (1)        DEFAULT ('F') NULL,
    [C_OSZTV]                        CHAR (1)        DEFAULT ('F') NULL,
    [C_SZETVAGAZAT]                  CHAR (1)        DEFAULT ('F') NULL,
    [C_SZINTVIZSGA]                  NUMERIC (10, 2) NULL,
    [C_SZKTV]                        CHAR (1)        DEFAULT ('F') NULL,
    [C_TECHNIKUSIEVFOLYAM]           CHAR (1)        DEFAULT ('F') NULL,
    [C_TANTERVID]                    INT             NOT NULL,
    [C_FELVETELTANEVEID]             INT             NOT NULL,
    [C_ALINTEZMENYID]                INT             NOT NULL,
    [C_ALTANEVID]                    INT             NOT NULL,
    [TOROLT]                         CHAR (1)        DEFAULT ('F') NULL,
    [SERIAL]                         INT             NULL,
    [LASTCHANGED]                    DATETIME        DEFAULT (getdate()) NULL,
    [CREATED]                        DATETIME        DEFAULT (getdate()) NULL,
    [MODIFIER]                       INT             NULL,
    [CREATOR]                        INT             NULL,
    CONSTRAINT [tmp_ms_xx_constraint_PK_T_40251781] PRIMARY KEY CLUSTERED ([ID] ASC)
);

IF EXISTS (SELECT TOP 1 1 
           FROM   [dbo].[T_TANULO])
    BEGIN
        INSERT INTO [dbo].[tmp_ms_xx_T_TANULO] ([ID], [C_ALLAMIGONDOZOTT], [C_BANKSZAMLASZAM], [C_BEILLESZKEDESINEHEZSEG], [C_BEIRASINAPLOSORSZAM], [C_BEJARO], [C_DIAKIGAZOLVANYKELTE], [C_DIAKIGAZOLVANYSZAM], [C_ELOZOINTEZMENY], [C_EVISMETLO], [C_INGYENESTANKONVYELLATASA], [C_JOGVISZONYATSZUNETELTETO], [C_MAGANTANULO], [C_MAGANTANULOSAGANAKOKA], [C_MAGANTANULOSAGKEZDETE], [C_NAPLOSORSZAM], [C_POLGARISZERZODESES], [C_SZAKMAIGYAKORLATON], [C_SZOCIALISTAMOGATAS], [C_TANDIJATFIZETO], [C_TANKOTELEZETT], [C_TANKOTELEZETTSEGVEGE], [C_TANULOSZERZODESES], [C_TERITESIDIJATFIZETO], [C_TESTNEVELESTIPUSA], [C_VENDEG], [C_BTMPROBLEMAS], [C_DIAKSPORTKOROS], [C_EGYHAZKOZOSSEGE], [C_ETKEZESIKEDVEZMENY], [C_HALMOZOTTANFOGYATEKOS], [C_HATRANYOSHELYZETU], [C_KOLLEGIUMIELLATASOS], [C_RENDSZERESGYERMEKVEDELMIKEDV], [C_SAJATOSNEVELESU], [C_SPORTAG], [C_SPORTEDZONEVE], [C_SPORTKLUB], [C_SZAKKEPESITESSZAMA], [C_TANULOIJOGVISZONYOSELTARTOTT], [C_TARTOSGYOGYKEZELESSZAMA], [C_TOBBGYERMEKIGAZOLASSZAMA], [C_VALLASA], [C_VESZELYEZTETETT], [C_JOGVISZONYVARHATOBEFEJEZESE], [C_BEILLESZKEDESIPROBLEMAVALKUZ], [C_BESZEDFOGYATEKOSOKMANYSZAM], [C_BNOKOD], [C_BTMHATAROZATOKMANYSZAM], [C_BTMHATAROZATTARTALMA], [C_BTMKIALLITOINTEZMENY], [C_BTMKONTROLLIDOPONT], [C_BTMLETSZAMSULY], [C_BTMOKMANYERVENYESSEGKEZDETE], [C_BTMOKMANYERVENYESSEGVEGE], [C_DISZGRAFIAOKMANYSZAM], [C_DISZKALKULIAOKMANYSZAM], [C_DISZLEXIAOKMANYSZAM], [C_ERTELMIFOGYATEKOS], [C_ERTELMIFOGYATEKOSOKMANYSZAM], [C_FEJLESZTESREKIJELOLT], [C_FEJLESZTOFOGLALKOZAS], [C_FEJLESZTOFOGLALKOZASORASZAM], [C_HALLASSERULT], [C_HALLASSERULTOKMANYSZAM], [C_LATASSERULT], [C_LATASSERULTOKMANYSZAM], [C_MAGATARTASIPROBLEMAVALKUZD], [C_MEGISMERONEMORGANIKUSOKMANYS], [C_MEGISMEROORGANIKUSOKMANYSZAM], [C_MOZGASSERULTOKMANYSZAM], [C_SNIKIALLITOINTEZMENY], [C_SNIKONTROLLIDOPONT], [C_SNILETSZAMSULY], [C_SNIMEGHATAROZAS], [C_SNIOKMANYERVENYESSEGKEZDETE], [C_SNIOKMANYERVENYESSEGVEGE], [C_TANULASIPROBLEMADISZGRAFIA], [C_TANULASIPROBLEMAVALKUZD], [C_TANULASIPROBLEMAVALKUZDDISZK], [C_TANULASIPROBLEMAVALKUZDDISZL], [C_VISELKEDESNEMORGANIKUSOKMANY], [C_VISELKEDESORGANIKUSOKMANYSZA], [C_ELSOINTEZMENYOMKOD], [C_EVISMETLOTANTARGYAK], [C_KOZEPFOKUOKTATASBATIZENHATOD], [C_MENEDEKJOGGALRENDELKEZO], [C_AGAZAT], [C_RESZSZAKKEPESITES], [C_SZAKKEPESITES], [C_SZAKMACSOPORT], [C_TANTERVID], [C_FELVETELTANEVEID], [C_ALINTEZMENYID], [C_ALTANEVID], [TOROLT], [SERIAL], [LASTCHANGED], [CREATED], [MODIFIER], [CREATOR])
        SELECT   [ID],
                 [C_ALLAMIGONDOZOTT],
                 [C_BANKSZAMLASZAM],
                 [C_BEILLESZKEDESINEHEZSEG],
                 [C_BEIRASINAPLOSORSZAM],
                 [C_BEJARO],
                 [C_DIAKIGAZOLVANYKELTE],
                 [C_DIAKIGAZOLVANYSZAM],
                 [C_ELOZOINTEZMENY],
                 [C_EVISMETLO],
                 [C_INGYENESTANKONVYELLATASA],
                 [C_JOGVISZONYATSZUNETELTETO],
                 [C_MAGANTANULO],
                 [C_MAGANTANULOSAGANAKOKA],
                 [C_MAGANTANULOSAGKEZDETE],
                 [C_NAPLOSORSZAM],
                 [C_POLGARISZERZODESES],
                 [C_SZAKMAIGYAKORLATON],
                 [C_SZOCIALISTAMOGATAS],
                 [C_TANDIJATFIZETO],
                 [C_TANKOTELEZETT],
                 [C_TANKOTELEZETTSEGVEGE],
                 [C_TANULOSZERZODESES],
                 [C_TERITESIDIJATFIZETO],
                 [C_TESTNEVELESTIPUSA],
                 [C_VENDEG],
                 [C_BTMPROBLEMAS],
                 [C_DIAKSPORTKOROS],
                 [C_EGYHAZKOZOSSEGE],
                 [C_ETKEZESIKEDVEZMENY],
                 [C_HALMOZOTTANFOGYATEKOS],
                 [C_HATRANYOSHELYZETU],
                 [C_KOLLEGIUMIELLATASOS],
                 [C_RENDSZERESGYERMEKVEDELMIKEDV],
                 [C_SAJATOSNEVELESU],
                 [C_SPORTAG],
                 [C_SPORTEDZONEVE],
                 [C_SPORTKLUB],
                 [C_SZAKKEPESITESSZAMA],
                 [C_TANULOIJOGVISZONYOSELTARTOTT],
                 [C_TARTOSGYOGYKEZELESSZAMA],
                 [C_TOBBGYERMEKIGAZOLASSZAMA],
                 [C_VALLASA],
                 [C_VESZELYEZTETETT],
                 [C_JOGVISZONYVARHATOBEFEJEZESE],
                 [C_BEILLESZKEDESIPROBLEMAVALKUZ],
                 [C_BESZEDFOGYATEKOSOKMANYSZAM],
                 [C_BNOKOD],
                 [C_BTMHATAROZATOKMANYSZAM],
                 [C_BTMHATAROZATTARTALMA],
                 [C_BTMKIALLITOINTEZMENY],
                 [C_BTMKONTROLLIDOPONT],
                 [C_BTMLETSZAMSULY],
                 [C_BTMOKMANYERVENYESSEGKEZDETE],
                 [C_BTMOKMANYERVENYESSEGVEGE],
                 [C_DISZGRAFIAOKMANYSZAM],
                 [C_DISZKALKULIAOKMANYSZAM],
                 [C_DISZLEXIAOKMANYSZAM],
                 [C_ERTELMIFOGYATEKOS],
                 [C_ERTELMIFOGYATEKOSOKMANYSZAM],
                 [C_FEJLESZTESREKIJELOLT],
                 [C_FEJLESZTOFOGLALKOZAS],
                 [C_FEJLESZTOFOGLALKOZASORASZAM],
                 [C_HALLASSERULT],
                 [C_HALLASSERULTOKMANYSZAM],
                 [C_LATASSERULT],
                 [C_LATASSERULTOKMANYSZAM],
                 [C_MAGATARTASIPROBLEMAVALKUZD],
                 [C_MEGISMERONEMORGANIKUSOKMANYS],
                 [C_MEGISMEROORGANIKUSOKMANYSZAM],
                 [C_MOZGASSERULTOKMANYSZAM],
                 [C_SNIKIALLITOINTEZMENY],
                 [C_SNIKONTROLLIDOPONT],
                 [C_SNILETSZAMSULY],
                 [C_SNIMEGHATAROZAS],
                 [C_SNIOKMANYERVENYESSEGKEZDETE],
                 [C_SNIOKMANYERVENYESSEGVEGE],
                 [C_TANULASIPROBLEMADISZGRAFIA],
                 [C_TANULASIPROBLEMAVALKUZD],
                 [C_TANULASIPROBLEMAVALKUZDDISZK],
                 [C_TANULASIPROBLEMAVALKUZDDISZL],
                 [C_VISELKEDESNEMORGANIKUSOKMANY],
                 [C_VISELKEDESORGANIKUSOKMANYSZA],
                 [C_ELSOINTEZMENYOMKOD],
                 [C_EVISMETLOTANTARGYAK],
                 [C_KOZEPFOKUOKTATASBATIZENHATOD],
                 [C_MENEDEKJOGGALRENDELKEZO],
                 [C_AGAZAT],
                 [C_RESZSZAKKEPESITES],
                 [C_SZAKKEPESITES],
                 [C_SZAKMACSOPORT],
                 [C_TANTERVID],
                 [C_FELVETELTANEVEID],
                 [C_ALINTEZMENYID],
                 [C_ALTANEVID],
                 [TOROLT],
                 [SERIAL],
                 [LASTCHANGED],
                 [CREATED],
                 [MODIFIER],
                 [CREATOR]
        FROM     [dbo].[T_TANULO]
        ORDER BY [ID] ASC;
    END

DROP TABLE [dbo].[T_TANULO];

EXECUTE sp_rename N'[dbo].[tmp_ms_xx_T_TANULO]', N'T_TANULO';

EXECUTE sp_rename N'[dbo].[tmp_ms_xx_constraint_PK_T_40251781]', N'PK_T_4025178', N'OBJECT';

COMMIT TRANSACTION;

SET TRANSACTION ISOLATION LEVEL READ COMMITTED;


GO
PRINT N'Creating [dbo].[T_TANULO].[I_T_4025178_4025259]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025178_4025259]
    ON [dbo].[T_TANULO]([C_ALINTEZMENYID] ASC, [C_ALTANEVID] ASC, [C_INGYENESTANKONVYELLATASA] ASC);


GO
PRINT N'Creating [dbo].[T_TANULO].[I_T_4025178_4025262]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025178_4025262]
    ON [dbo].[T_TANULO]([C_ALINTEZMENYID] ASC, [C_ALTANEVID] ASC, [C_MAGANTANULOSAGANAKOKA] ASC);


GO
PRINT N'Creating [dbo].[T_TANULO].[I_T_4025178_4025274]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025178_4025274]
    ON [dbo].[T_TANULO]([C_ALINTEZMENYID] ASC, [C_ALTANEVID] ASC, [C_TESTNEVELESTIPUSA] ASC);


GO
PRINT N'Creating [dbo].[T_TANULO].[I_T_4025178_4025344]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025178_4025344]
    ON [dbo].[T_TANULO]([C_ALINTEZMENYID] ASC, [C_ALTANEVID] ASC, [C_ETKEZESIKEDVEZMENY] ASC);


GO
PRINT N'Creating [dbo].[T_TANULO].[I_T_4025178_4025346]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025178_4025346]
    ON [dbo].[T_TANULO]([C_ALINTEZMENYID] ASC, [C_ALTANEVID] ASC, [C_HATRANYOSHELYZETU] ASC);


GO
PRINT N'Creating [dbo].[T_TANULO].[I_T_4025178_4025357]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025178_4025357]
    ON [dbo].[T_TANULO]([C_ALINTEZMENYID] ASC, [C_ALTANEVID] ASC, [C_VALLASA] ASC);


GO
PRINT N'Creating [dbo].[T_TANULO].[I_T_4025178_4025488]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025178_4025488]
    ON [dbo].[T_TANULO]([C_ALINTEZMENYID] ASC, [C_ALTANEVID] ASC, [C_ERTELMIFOGYATEKOS] ASC);


GO
PRINT N'Creating [dbo].[T_TANULO].[I_T_4025178_4025493]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025178_4025493]
    ON [dbo].[T_TANULO]([C_ALINTEZMENYID] ASC, [C_ALTANEVID] ASC, [C_HALLASSERULT] ASC);


GO
PRINT N'Creating [dbo].[T_TANULO].[I_T_4025178_4025495]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025178_4025495]
    ON [dbo].[T_TANULO]([C_ALINTEZMENYID] ASC, [C_ALTANEVID] ASC, [C_LATASSERULT] ASC);


GO
PRINT N'Creating [dbo].[T_TANULO].[I_T_4025178_4027540]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025178_4027540]
    ON [dbo].[T_TANULO]([C_ALINTEZMENYID] ASC, [C_ALTANEVID] ASC, [C_AGAZAT] ASC);


GO
PRINT N'Creating [dbo].[T_TANULO].[I_T_4025178_4027541]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025178_4027541]
    ON [dbo].[T_TANULO]([C_ALINTEZMENYID] ASC, [C_ALTANEVID] ASC, [C_RESZSZAKKEPESITES] ASC);


GO
PRINT N'Creating [dbo].[T_TANULO].[I_T_4025178_4027542]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025178_4027542]
    ON [dbo].[T_TANULO]([C_ALINTEZMENYID] ASC, [C_ALTANEVID] ASC, [C_SZAKKEPESITES] ASC);


GO
PRINT N'Creating [dbo].[T_TANULO].[I_T_4025178_4027543]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025178_4027543]
    ON [dbo].[T_TANULO]([C_ALINTEZMENYID] ASC, [C_ALTANEVID] ASC, [C_SZAKMACSOPORT] ASC);


GO
PRINT N'Creating [dbo].[T_TANULO].[I_T_4025416_4025415]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025416_4025415]
    ON [dbo].[T_TANULO]([C_TANTERVID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULO].[I_T_4026237_4026236]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4026237_4026236]
    ON [dbo].[T_TANULO]([C_FELVETELTANEVEID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULO].[I_T_402517802_402517800]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402517802_402517800]
    ON [dbo].[T_TANULO]([C_ALINTEZMENYID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULO].[I_T_402517805_402517803]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402517805_402517803]
    ON [dbo].[T_TANULO]([C_ALTANEVID] ASC);


GO
PRINT N'Creating [dbo].[FK_4025792_4025791]...';


GO
ALTER TABLE [dbo].[T_ORALATOGATAS] WITH NOCHECK
    ADD CONSTRAINT [FK_4025792_4025791] FOREIGN KEY ([C_ERTEKELOID]) REFERENCES [dbo].[T_ALKALMAZOTT] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4025945_4025944]...';


GO
ALTER TABLE [dbo].[T_TANARITANTARGY] WITH NOCHECK
    ADD CONSTRAINT [FK_4025945_4025944] FOREIGN KEY ([C_ALKALMAZOTTID]) REFERENCES [dbo].[T_ALKALMAZOTT] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4026291_4026289]...';


GO
ALTER TABLE [dbo].[T_HELYETTESITESIIDOSZAK] WITH NOCHECK
    ADD CONSTRAINT [FK_4026291_4026289] FOREIGN KEY ([C_HELYETTESTANAROKID]) REFERENCES [dbo].[T_ALKALMAZOTT] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4025326_4025325]...';


GO
ALTER TABLE [dbo].[T_CSOPORT] WITH NOCHECK
    ADD CONSTRAINT [FK_4025326_4025325] FOREIGN KEY ([C_CSOPORTVEZETOID]) REFERENCES [dbo].[T_ALKALMAZOTT] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4027571_4027569]...';


GO
ALTER TABLE [dbo].[T_TOVABBIMUNKAUGYIADATOK] WITH NOCHECK
    ADD CONSTRAINT [FK_4027571_4027569] FOREIGN KEY ([C_ALKALMAZOTTID]) REFERENCES [dbo].[T_ALKALMAZOTT] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4025910_4025909]...';


GO
ALTER TABLE [dbo].[T_JOGYAKORLAT] WITH NOCHECK
    ADD CONSTRAINT [FK_4025910_4025909] FOREIGN KEY ([C_JOGYAKORLATTULAJDONOSID]) REFERENCES [dbo].[T_ALKALMAZOTT] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4025714_4025713]...';


GO
ALTER TABLE [dbo].[T_TANULOESEMENY] WITH NOCHECK
    ADD CONSTRAINT [FK_4025714_4025713] FOREIGN KEY ([C_FELJEGYZOID]) REFERENCES [dbo].[T_ALKALMAZOTT] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4025633_4025631]...';


GO
ALTER TABLE [dbo].[T_ORAK_TANAROK] WITH NOCHECK
    ADD CONSTRAINT [FK_4025633_4025631] FOREIGN KEY ([C_TANAROKID]) REFERENCES [dbo].[T_ALKALMAZOTT] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4025437_4025435]...';


GO
ALTER TABLE [dbo].[T_FOGLALKOZASOK_TANAROK] WITH NOCHECK
    ADD CONSTRAINT [FK_4025437_4025435] FOREIGN KEY ([C_TANAROKID]) REFERENCES [dbo].[T_ALKALMAZOTT] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4026129_4026127]...';


GO
ALTER TABLE [dbo].[T_MUNKAUGYIADATOK] WITH NOCHECK
    ADD CONSTRAINT [FK_4026129_4026127] FOREIGN KEY ([C_ALKALMAZOTTID]) REFERENCES [dbo].[T_ALKALMAZOTT] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4027463_4027462]...';


GO
ALTER TABLE [dbo].[T_PEDAGOGUSIKTADATSZOLGALTATAS] WITH NOCHECK
    ADD CONSTRAINT [FK_4027463_4027462] FOREIGN KEY ([C_ALKALMAZOTTID]) REFERENCES [dbo].[T_ALKALMAZOTT] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4026685_4026684]...';


GO
ALTER TABLE [dbo].[T_NEMKOTOTTMUNKAIDO] WITH NOCHECK
    ADD CONSTRAINT [FK_4026685_4026684] FOREIGN KEY ([C_TANARID]) REFERENCES [dbo].[T_ALKALMAZOTT] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4025670_4025669]...';


GO
ALTER TABLE [dbo].[T_TANULOERTEKELES] WITH NOCHECK
    ADD CONSTRAINT [FK_4025670_4025669] FOREIGN KEY ([C_ERTEKELOID]) REFERENCES [dbo].[T_ALKALMAZOTT] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4025629_4025628]...';


GO
ALTER TABLE [dbo].[T_TANITASIORA] WITH NOCHECK
    ADD CONSTRAINT [FK_4025629_4025628] FOREIGN KEY ([C_HELYETTESITOTANARID]) REFERENCES [dbo].[T_ALKALMAZOTT] ([ID]);


GO
PRINT N'Creating [dbo].[FK_T_8935_4025165]...';


GO
ALTER TABLE [dbo].[T_ALKALMAZOTT] WITH NOCHECK
    ADD CONSTRAINT [FK_T_8935_4025165] FOREIGN KEY ([ID]) REFERENCES [dbo].[T_FELHASZNALO] ([ID]);


GO
PRINT N'Creating [dbo].[FK_402513902_402513900]...';


GO
ALTER TABLE [dbo].[T_ALKALMAZOTT] WITH NOCHECK
    ADD CONSTRAINT [FK_402513902_402513900] FOREIGN KEY ([C_ALINTEZMENYID]) REFERENCES [dbo].[T_INTEZMENY] ([ID]);


GO
PRINT N'Creating [dbo].[FK_402513905_402513903]...';


GO
ALTER TABLE [dbo].[T_ALKALMAZOTT] WITH NOCHECK
    ADD CONSTRAINT [FK_402513905_402513903] FOREIGN KEY ([C_ALTANEVID]) REFERENCES [dbo].[T_TANEV] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4025850_4025849]...';


GO
ALTER TABLE [dbo].[T_TEVEKENYSEG] WITH NOCHECK
    ADD CONSTRAINT [FK_4025850_4025849] FOREIGN KEY ([C_ESEMENYTULAJDONOSID]) REFERENCES [dbo].[T_ALKALMAZOTT] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4026131_4026130]...';


GO
ALTER TABLE [dbo].[T_TEREM] WITH NOCHECK
    ADD CONSTRAINT [FK_4026131_4026130] FOREIGN KEY ([C_TEREMFELELOSID]) REFERENCES [dbo].[T_ALKALMAZOTT] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4025605_4025604]...';


GO
ALTER TABLE [dbo].[T_TANMENET] WITH NOCHECK
    ADD CONSTRAINT [FK_4025605_4025604] FOREIGN KEY ([C_FELTOLTOID]) REFERENCES [dbo].[T_ALKALMAZOTT] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4026327_4026325]...';


GO
ALTER TABLE [dbo].[T_ORARENDIORA] WITH NOCHECK
    ADD CONSTRAINT [FK_4026327_4026325] FOREIGN KEY ([C_TANARID]) REFERENCES [dbo].[T_ALKALMAZOTT] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4025281_4025280]...';


GO
ALTER TABLE [dbo].[T_ESZKOZ] WITH NOCHECK
    ADD CONSTRAINT [FK_4025281_4025280] FOREIGN KEY ([C_FELELOSID]) REFERENCES [dbo].[T_ALKALMAZOTT] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4025320_4025319]...';


GO
ALTER TABLE [dbo].[T_OSZTALY] WITH NOCHECK
    ADD CONSTRAINT [FK_4025320_4025319] FOREIGN KEY ([C_OSZTALYFONOKID]) REFERENCES [dbo].[T_ALKALMAZOTT] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4025323_4025322]...';


GO
ALTER TABLE [dbo].[T_OSZTALY] WITH NOCHECK
    ADD CONSTRAINT [FK_4025323_4025322] FOREIGN KEY ([C_OFOHELYETTESID]) REFERENCES [dbo].[T_ALKALMAZOTT] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4025761_4025759]...';


GO
ALTER TABLE [dbo].[T_IGAZOLAS] WITH NOCHECK
    ADD CONSTRAINT [FK_4025761_4025759] FOREIGN KEY ([C_ROGZITOID]) REFERENCES [dbo].[T_ALKALMAZOTT] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4026359_4026358]...';


GO
ALTER TABLE [dbo].[T_INTEZMENYADATSZOLGALTATAS] WITH NOCHECK
    ADD CONSTRAINT [FK_4026359_4026358] FOREIGN KEY ([C_INTEZMENYID]) REFERENCES [dbo].[T_INTEZMENY] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4026362_4026361]...';


GO
ALTER TABLE [dbo].[T_INTEZMENYADATSZOLGALTATAS] WITH NOCHECK
    ADD CONSTRAINT [FK_4026362_4026361] FOREIGN KEY ([C_TANEVID]) REFERENCES [dbo].[T_TANEV] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4025788_4025787]...';


GO
ALTER TABLE [dbo].[T_DIAKIGAZOLVANYIGENYLES] WITH NOCHECK
    ADD CONSTRAINT [FK_4025788_4025787] FOREIGN KEY ([C_TANULOID]) REFERENCES [dbo].[T_TANULO] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4027621_4027620]...';


GO
ALTER TABLE [dbo].[T_ERETTSEGIEREDMENY] WITH NOCHECK
    ADD CONSTRAINT [FK_4027621_4027620] FOREIGN KEY ([C_TANULOID]) REFERENCES [dbo].[T_TANULO] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4025711_4025710]...';


GO
ALTER TABLE [dbo].[T_TANULO_TANULOESEMENY] WITH NOCHECK
    ADD CONSTRAINT [FK_4025711_4025710] FOREIGN KEY ([C_TANULOID]) REFERENCES [dbo].[T_TANULO] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4026179_4026177]...';


GO
ALTER TABLE [dbo].[T_TANULOKOZOSSEGISZOLGALAT] WITH NOCHECK
    ADD CONSTRAINT [FK_4026179_4026177] FOREIGN KEY ([C_TANULOID]) REFERENCES [dbo].[T_TANULO] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4025178_4025259]...';


GO
ALTER TABLE [dbo].[T_TANULO] WITH NOCHECK
    ADD CONSTRAINT [FK_4025178_4025259] FOREIGN KEY ([C_INGYENESTANKONVYELLATASA], [C_ALINTEZMENYID], [C_ALTANEVID]) REFERENCES [dbo].[T_INGYENESTANKONYVELLATAS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


GO
PRINT N'Creating [dbo].[FK_4025178_4025262]...';


GO
ALTER TABLE [dbo].[T_TANULO] WITH NOCHECK
    ADD CONSTRAINT [FK_4025178_4025262] FOREIGN KEY ([C_MAGANTANULOSAGANAKOKA], [C_ALINTEZMENYID], [C_ALTANEVID]) REFERENCES [dbo].[T_MAGANTANULOSAGOKA] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


GO
PRINT N'Creating [dbo].[FK_4025178_4025274]...';


GO
ALTER TABLE [dbo].[T_TANULO] WITH NOCHECK
    ADD CONSTRAINT [FK_4025178_4025274] FOREIGN KEY ([C_TESTNEVELESTIPUSA], [C_ALINTEZMENYID], [C_ALTANEVID]) REFERENCES [dbo].[T_TESTNEVELESTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


GO
PRINT N'Creating [dbo].[FK_4025178_4025344]...';


GO
ALTER TABLE [dbo].[T_TANULO] WITH NOCHECK
    ADD CONSTRAINT [FK_4025178_4025344] FOREIGN KEY ([C_ETKEZESIKEDVEZMENY], [C_ALINTEZMENYID], [C_ALTANEVID]) REFERENCES [dbo].[T_ETKEZESIKEDVEZMENYTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


GO
PRINT N'Creating [dbo].[FK_4025178_4025346]...';


GO
ALTER TABLE [dbo].[T_TANULO] WITH NOCHECK
    ADD CONSTRAINT [FK_4025178_4025346] FOREIGN KEY ([C_HATRANYOSHELYZETU], [C_ALINTEZMENYID], [C_ALTANEVID]) REFERENCES [dbo].[T_HATRANYOSHELYZETTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


GO
PRINT N'Creating [dbo].[FK_4025178_4025357]...';


GO
ALTER TABLE [dbo].[T_TANULO] WITH NOCHECK
    ADD CONSTRAINT [FK_4025178_4025357] FOREIGN KEY ([C_VALLASA], [C_ALINTEZMENYID], [C_ALTANEVID]) REFERENCES [dbo].[T_VALLAS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


GO
PRINT N'Creating [dbo].[FK_4025178_4025488]...';


GO
ALTER TABLE [dbo].[T_TANULO] WITH NOCHECK
    ADD CONSTRAINT [FK_4025178_4025488] FOREIGN KEY ([C_ERTELMIFOGYATEKOS], [C_ALINTEZMENYID], [C_ALTANEVID]) REFERENCES [dbo].[T_ERTELMIFOGYATEKOSTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


GO
PRINT N'Creating [dbo].[FK_4025178_4025493]...';


GO
ALTER TABLE [dbo].[T_TANULO] WITH NOCHECK
    ADD CONSTRAINT [FK_4025178_4025493] FOREIGN KEY ([C_HALLASSERULT], [C_ALINTEZMENYID], [C_ALTANEVID]) REFERENCES [dbo].[T_HALLASSERULTTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


GO
PRINT N'Creating [dbo].[FK_4025178_4025495]...';


GO
ALTER TABLE [dbo].[T_TANULO] WITH NOCHECK
    ADD CONSTRAINT [FK_4025178_4025495] FOREIGN KEY ([C_LATASSERULT], [C_ALINTEZMENYID], [C_ALTANEVID]) REFERENCES [dbo].[T_LATASSERULTTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


GO
PRINT N'Creating [dbo].[FK_4025178_4027540]...';


GO
ALTER TABLE [dbo].[T_TANULO] WITH NOCHECK
    ADD CONSTRAINT [FK_4025178_4027540] FOREIGN KEY ([C_AGAZAT], [C_ALINTEZMENYID], [C_ALTANEVID]) REFERENCES [dbo].[T_AGAZATTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


GO
PRINT N'Creating [dbo].[FK_4025178_4027541]...';


GO
ALTER TABLE [dbo].[T_TANULO] WITH NOCHECK
    ADD CONSTRAINT [FK_4025178_4027541] FOREIGN KEY ([C_RESZSZAKKEPESITES], [C_ALINTEZMENYID], [C_ALTANEVID]) REFERENCES [dbo].[T_RESZSZAKKEPESITESTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


GO
PRINT N'Creating [dbo].[FK_4025178_4027542]...';


GO
ALTER TABLE [dbo].[T_TANULO] WITH NOCHECK
    ADD CONSTRAINT [FK_4025178_4027542] FOREIGN KEY ([C_SZAKKEPESITES], [C_ALINTEZMENYID], [C_ALTANEVID]) REFERENCES [dbo].[T_SZAKKEPESITESTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


GO
PRINT N'Creating [dbo].[FK_4025178_4027543]...';


GO
ALTER TABLE [dbo].[T_TANULO] WITH NOCHECK
    ADD CONSTRAINT [FK_4025178_4027543] FOREIGN KEY ([C_SZAKMACSOPORT], [C_ALINTEZMENYID], [C_ALTANEVID]) REFERENCES [dbo].[T_SZAKMACSOPORTTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


GO
PRINT N'Creating [dbo].[FK_T_8935_4025190]...';


GO
ALTER TABLE [dbo].[T_TANULO] WITH NOCHECK
    ADD CONSTRAINT [FK_T_8935_4025190] FOREIGN KEY ([ID]) REFERENCES [dbo].[T_FELHASZNALO] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4025416_4025415]...';


GO
ALTER TABLE [dbo].[T_TANULO] WITH NOCHECK
    ADD CONSTRAINT [FK_4025416_4025415] FOREIGN KEY ([C_TANTERVID]) REFERENCES [dbo].[T_TANTERV] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4026237_4026236]...';


GO
ALTER TABLE [dbo].[T_TANULO] WITH NOCHECK
    ADD CONSTRAINT [FK_4026237_4026236] FOREIGN KEY ([C_FELVETELTANEVEID]) REFERENCES [dbo].[T_TANEV] ([ID]);


GO
PRINT N'Creating [dbo].[FK_402517802_402517800]...';


GO
ALTER TABLE [dbo].[T_TANULO] WITH NOCHECK
    ADD CONSTRAINT [FK_402517802_402517800] FOREIGN KEY ([C_ALINTEZMENYID]) REFERENCES [dbo].[T_INTEZMENY] ([ID]);


GO
PRINT N'Creating [dbo].[FK_402517805_402517803]...';


GO
ALTER TABLE [dbo].[T_TANULO] WITH NOCHECK
    ADD CONSTRAINT [FK_402517805_402517803] FOREIGN KEY ([C_ALTANEVID]) REFERENCES [dbo].[T_TANEV] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4025673_4025672]...';


GO
ALTER TABLE [dbo].[T_TANULOMULASZTAS] WITH NOCHECK
    ADD CONSTRAINT [FK_4025673_4025672] FOREIGN KEY ([C_ORATANULOIID]) REFERENCES [dbo].[T_TANULO] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4025181_4025180]...';


GO
ALTER TABLE [dbo].[T_GONDVISELO] WITH NOCHECK
    ADD CONSTRAINT [FK_4025181_4025180] FOREIGN KEY ([C_TANULOID]) REFERENCES [dbo].[T_TANULO] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4025665_4025663]...';


GO
ALTER TABLE [dbo].[T_TANULOERTEKELES] WITH NOCHECK
    ADD CONSTRAINT [FK_4025665_4025663] FOREIGN KEY ([C_TANULOID]) REFERENCES [dbo].[T_TANULO] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4026674_4026673]...';


GO
ALTER TABLE [dbo].[T_TANULOESLADATOK] WITH NOCHECK
    ADD CONSTRAINT [FK_4026674_4026673] FOREIGN KEY ([C_TANULOID]) REFERENCES [dbo].[T_TANULO] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4026076_4026075]...';


GO
ALTER TABLE [dbo].[T_TANULOTARGYMULASZTASSTATISZT] WITH NOCHECK
    ADD CONSTRAINT [FK_4026076_4026075] FOREIGN KEY ([C_TANULOMULASZTASSTATISZTIKAII]) REFERENCES [dbo].[T_TANULO] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4026073_4026072]...';


GO
ALTER TABLE [dbo].[T_TANULOMULASZTASSTATISZTIKA] WITH NOCHECK
    ADD CONSTRAINT [FK_4026073_4026072] FOREIGN KEY ([C_TANULOID]) REFERENCES [dbo].[T_TANULO] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4025780_4025778]...';


GO
ALTER TABLE [dbo].[T_TANULOMENTESSEG] WITH NOCHECK
    ADD CONSTRAINT [FK_4025780_4025778] FOREIGN KEY ([C_TANULOID]) REFERENCES [dbo].[T_TANULO] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4025527_4025525]...';


GO
ALTER TABLE [dbo].[T_TANULOCSOPORT] WITH NOCHECK
    ADD CONSTRAINT [FK_4025527_4025525] FOREIGN KEY ([C_TANULOID]) REFERENCES [dbo].[T_TANULO] ([ID]);


GO
PRINT N'Creating [dbo].[FK_4025758_4025756]...';


GO
ALTER TABLE [dbo].[T_IGAZOLAS] WITH NOCHECK
    ADD CONSTRAINT [FK_4025758_4025756] FOREIGN KEY ([C_TANULOID]) REFERENCES [dbo].[T_TANULO] ([ID]);


GO
PRINT N'Refreshing [dbo].[T_ALKALMAZOTT_OSSZES]...';


GO
EXECUTE sp_refreshsqlmodule N'[dbo].[T_ALKALMAZOTT_OSSZES]';


GO
PRINT N'Refreshing [dbo].[T_INTEZMENYADATSZOLGALTATAS_OSSZES]...';


GO
EXECUTE sp_refreshsqlmodule N'[dbo].[T_INTEZMENYADATSZOLGALTATAS_OSSZES]';


GO
PRINT N'Refreshing [dbo].[T_TANULO_OSSZES]...';


GO
EXECUTE sp_refreshsqlmodule N'[dbo].[T_TANULO_OSSZES]';


GO
PRINT N'Refreshing [dbo].[sp_Global_GenerateTanevAdatok]...';


GO
EXECUTE sp_refreshsqlmodule N'[dbo].[sp_Global_GenerateTanevAdatok]';


GO
PRINT N'Refreshing [dbo].[sp_Global_IntezmenyLetrehozas]...';


GO
EXECUTE sp_refreshsqlmodule N'[dbo].[sp_Global_IntezmenyLetrehozas]';


GO
PRINT N'Checking existing data against newly created constraints';


GO
ALTER TABLE [dbo].[T_ORALATOGATAS] WITH CHECK CHECK CONSTRAINT [FK_4025792_4025791];

ALTER TABLE [dbo].[T_TANARITANTARGY] WITH CHECK CHECK CONSTRAINT [FK_4025945_4025944];

ALTER TABLE [dbo].[T_HELYETTESITESIIDOSZAK] WITH CHECK CHECK CONSTRAINT [FK_4026291_4026289];

ALTER TABLE [dbo].[T_CSOPORT] WITH CHECK CHECK CONSTRAINT [FK_4025326_4025325];

ALTER TABLE [dbo].[T_TOVABBIMUNKAUGYIADATOK] WITH CHECK CHECK CONSTRAINT [FK_4027571_4027569];

ALTER TABLE [dbo].[T_JOGYAKORLAT] WITH CHECK CHECK CONSTRAINT [FK_4025910_4025909];

ALTER TABLE [dbo].[T_TANULOESEMENY] WITH CHECK CHECK CONSTRAINT [FK_4025714_4025713];

ALTER TABLE [dbo].[T_ORAK_TANAROK] WITH CHECK CHECK CONSTRAINT [FK_4025633_4025631];

ALTER TABLE [dbo].[T_FOGLALKOZASOK_TANAROK] WITH CHECK CHECK CONSTRAINT [FK_4025437_4025435];

ALTER TABLE [dbo].[T_MUNKAUGYIADATOK] WITH CHECK CHECK CONSTRAINT [FK_4026129_4026127];

ALTER TABLE [dbo].[T_PEDAGOGUSIKTADATSZOLGALTATAS] WITH CHECK CHECK CONSTRAINT [FK_4027463_4027462];

ALTER TABLE [dbo].[T_NEMKOTOTTMUNKAIDO] WITH CHECK CHECK CONSTRAINT [FK_4026685_4026684];

ALTER TABLE [dbo].[T_TANULOERTEKELES] WITH CHECK CHECK CONSTRAINT [FK_4025670_4025669];

ALTER TABLE [dbo].[T_TANITASIORA] WITH CHECK CHECK CONSTRAINT [FK_4025629_4025628];

ALTER TABLE [dbo].[T_ALKALMAZOTT] WITH CHECK CHECK CONSTRAINT [FK_T_8935_4025165];

ALTER TABLE [dbo].[T_ALKALMAZOTT] WITH CHECK CHECK CONSTRAINT [FK_402513902_402513900];

ALTER TABLE [dbo].[T_ALKALMAZOTT] WITH CHECK CHECK CONSTRAINT [FK_402513905_402513903];

ALTER TABLE [dbo].[T_TEVEKENYSEG] WITH CHECK CHECK CONSTRAINT [FK_4025850_4025849];

ALTER TABLE [dbo].[T_TEREM] WITH CHECK CHECK CONSTRAINT [FK_4026131_4026130];

ALTER TABLE [dbo].[T_TANMENET] WITH CHECK CHECK CONSTRAINT [FK_4025605_4025604];

ALTER TABLE [dbo].[T_ORARENDIORA] WITH CHECK CHECK CONSTRAINT [FK_4026327_4026325];

ALTER TABLE [dbo].[T_ESZKOZ] WITH CHECK CHECK CONSTRAINT [FK_4025281_4025280];

ALTER TABLE [dbo].[T_OSZTALY] WITH CHECK CHECK CONSTRAINT [FK_4025320_4025319];

ALTER TABLE [dbo].[T_OSZTALY] WITH CHECK CHECK CONSTRAINT [FK_4025323_4025322];

ALTER TABLE [dbo].[T_IGAZOLAS] WITH CHECK CHECK CONSTRAINT [FK_4025761_4025759];

ALTER TABLE [dbo].[T_INTEZMENYADATSZOLGALTATAS] WITH CHECK CHECK CONSTRAINT [FK_4026359_4026358];

ALTER TABLE [dbo].[T_INTEZMENYADATSZOLGALTATAS] WITH CHECK CHECK CONSTRAINT [FK_4026362_4026361];

ALTER TABLE [dbo].[T_DIAKIGAZOLVANYIGENYLES] WITH CHECK CHECK CONSTRAINT [FK_4025788_4025787];

ALTER TABLE [dbo].[T_ERETTSEGIEREDMENY] WITH CHECK CHECK CONSTRAINT [FK_4027621_4027620];

ALTER TABLE [dbo].[T_TANULO_TANULOESEMENY] WITH CHECK CHECK CONSTRAINT [FK_4025711_4025710];

ALTER TABLE [dbo].[T_TANULOKOZOSSEGISZOLGALAT] WITH CHECK CHECK CONSTRAINT [FK_4026179_4026177];

ALTER TABLE [dbo].[T_TANULO] WITH CHECK CHECK CONSTRAINT [FK_4025178_4025259];

ALTER TABLE [dbo].[T_TANULO] WITH CHECK CHECK CONSTRAINT [FK_4025178_4025262];

ALTER TABLE [dbo].[T_TANULO] WITH CHECK CHECK CONSTRAINT [FK_4025178_4025274];

ALTER TABLE [dbo].[T_TANULO] WITH CHECK CHECK CONSTRAINT [FK_4025178_4025344];

ALTER TABLE [dbo].[T_TANULO] WITH CHECK CHECK CONSTRAINT [FK_4025178_4025346];

ALTER TABLE [dbo].[T_TANULO] WITH CHECK CHECK CONSTRAINT [FK_4025178_4025357];

ALTER TABLE [dbo].[T_TANULO] WITH CHECK CHECK CONSTRAINT [FK_4025178_4025488];

ALTER TABLE [dbo].[T_TANULO] WITH CHECK CHECK CONSTRAINT [FK_4025178_4025493];

ALTER TABLE [dbo].[T_TANULO] WITH CHECK CHECK CONSTRAINT [FK_4025178_4025495];

ALTER TABLE [dbo].[T_TANULO] WITH CHECK CHECK CONSTRAINT [FK_4025178_4027540];

ALTER TABLE [dbo].[T_TANULO] WITH CHECK CHECK CONSTRAINT [FK_4025178_4027541];

ALTER TABLE [dbo].[T_TANULO] WITH CHECK CHECK CONSTRAINT [FK_4025178_4027542];

ALTER TABLE [dbo].[T_TANULO] WITH CHECK CHECK CONSTRAINT [FK_4025178_4027543];

ALTER TABLE [dbo].[T_TANULO] WITH CHECK CHECK CONSTRAINT [FK_T_8935_4025190];

ALTER TABLE [dbo].[T_TANULO] WITH CHECK CHECK CONSTRAINT [FK_4025416_4025415];

ALTER TABLE [dbo].[T_TANULO] WITH CHECK CHECK CONSTRAINT [FK_4026237_4026236];

ALTER TABLE [dbo].[T_TANULO] WITH CHECK CHECK CONSTRAINT [FK_402517802_402517800];

ALTER TABLE [dbo].[T_TANULO] WITH CHECK CHECK CONSTRAINT [FK_402517805_402517803];

ALTER TABLE [dbo].[T_TANULOMULASZTAS] WITH CHECK CHECK CONSTRAINT [FK_4025673_4025672];

ALTER TABLE [dbo].[T_GONDVISELO] WITH CHECK CHECK CONSTRAINT [FK_4025181_4025180];

ALTER TABLE [dbo].[T_TANULOERTEKELES] WITH CHECK CHECK CONSTRAINT [FK_4025665_4025663];

ALTER TABLE [dbo].[T_TANULOESLADATOK] WITH CHECK CHECK CONSTRAINT [FK_4026674_4026673];

ALTER TABLE [dbo].[T_TANULOTARGYMULASZTASSTATISZT] WITH CHECK CHECK CONSTRAINT [FK_4026076_4026075];

ALTER TABLE [dbo].[T_TANULOMULASZTASSTATISZTIKA] WITH CHECK CHECK CONSTRAINT [FK_4026073_4026072];

ALTER TABLE [dbo].[T_TANULOMENTESSEG] WITH CHECK CHECK CONSTRAINT [FK_4025780_4025778];

ALTER TABLE [dbo].[T_TANULOCSOPORT] WITH CHECK CHECK CONSTRAINT [FK_4025527_4025525];

ALTER TABLE [dbo].[T_IGAZOLAS] WITH CHECK CHECK CONSTRAINT [FK_4025758_4025756];


GO
PRINT N'Update complete.';


GO


PRINT '--- intézményi view-k (dbo táblákkal megegyező nevű és a tábla_OSSZES nevűek) frissítése ---'

DECLARE  @viewname nvarchar(100), @pureview nvarchar(100)

DECLARE semaviewk CURSOR LOCAL FOR 
  SELECT '['+TABLE_SCHEMA + '].[' + TABLE_NAME + ']', TABLE_NAME
  FROM INFORMATION_SCHEMA.TABLES
  WHERE TABLE_TYPE = 'VIEW' and TABLE_SCHEMA LIKE 'KR[_]%[_]Schema'
  AND TABLE_NAME in (
  'T_ALKALMAZOTT', 'T_ALKALMAZOTT_OSSZES',
  'T_INTEZMENYADATSZOLGALTATAS', 'T_INTEZMENYADATSZOLGALTATAS_OSSZES',
  'T_TANULO', 'T_TANULO_OSSZES'
  ) -- ha csak néhány VIEW frissült, akkor a gyorsabb futásért ide fel lehet sorolni
  ORDER BY TABLE_SCHEMA, TABLE_NAME

OPEN semaviewk
FETCH NEXT FROM semaviewk INTO @viewname, @pureview

WHILE @@FETCH_STATUS = 0 BEGIN
	PRINT @viewname
	EXEC sp_refreshview @viewname

    FETCH NEXT FROM semaviewk INTO @viewname, @pureview
END             

CLOSE semaviewk
DEALLOCATE semaviewk
GO


-- Triggerek inicializálás az összes táblára
DECLARE tableCursor CURSOR LOCAL FOR 
  SELECT DISTINCT TABLE_NAME
  FROM INFORMATION_SCHEMA.COLUMNS 
  WHERE COLUMN_NAME IN ('CREATOR', 'MODIFIER')
	AND TABLE_NAME NOT IN ('T_ENTITYHISTORY', 'T_ENTITYATTRIBUTEHISTORY', 'T_LOG', 'T_GLOBALLOCK', 'T_USERPROFILE', 'T_OLDALLATOGATOTTSAG')
	AND TABLE_NAME IN (
		SELECT t.name 
		FROM sys.tables t
		INNER JOIN sys.schemas s ON s.schema_id = t.schema_id
		WHERE s.name ='dbo' 
	)

DECLARE @table nvarchar(35)

OPEN tableCursor  
FETCH NEXT FROM tableCursor INTO @table  

WHILE @@FETCH_STATUS = 0 BEGIN  
  EXEC sp_Global_CreateTriggers @table
  FETCH NEXT FROM tableCursor INTO @table  
END  

CLOSE tableCursor  
DEALLOCATE tableCursor 


EXEC dev.sp_Global_GenerateAsyncAuditTriggerAll 1
GO

EXEC dev.sp_Global_GenerateAsyncAuditProcedureAll
GO

EXEC dev.sp_Global_GenerateAsyncAuditAuditPocessing
GO

ALTER QUEUE auditlog.AuditQueue WITH STATUS=OFF, ACTIVATION 
(STATUS = OFF)
GO

ALTER QUEUE auditlog.AuditQueue WITH STATUS=ON, ACTIVATION 
(STATUS = ON, MAX_QUEUE_READERS = 2)
GO
