﻿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_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_4028143_4028141]...';


GO
ALTER TABLE [dbo].[T_ORARENDIORATULAJDONSAG] DROP CONSTRAINT [FK_4028143_4028141];


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_HAZIFELADATOK] DROP CONSTRAINT [FK_4028285_4028284];


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


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


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

GO
IF OBJECT_ID('dbo.[FK_4025554_4025552]') IS NOT NULL 
	ALTER TABLE [dbo].[T_ORARENDIORA] DROP CONSTRAINT [FK_4025554_4025552];


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


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


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


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


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_4026329_4026328]...';


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


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


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


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


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


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_NAPLOELLENORZES] DROP CONSTRAINT [FK_4025763_4025762];


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


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


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_4025421_4025419]...';


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_CSOPORTOK_OSZTALYOK] DROP CONSTRAINT [FK_4025318_4025316];


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


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


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


GO
ALTER TABLE [dbo].[T_TANITASIORATULAJDONSAG] DROP CONSTRAINT [FK_4028146_4028144];


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


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


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


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


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


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


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


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


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


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


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


GO
IF OBJECT_ID('dbo.[FK_4025623_4025622]') IS NOT NULL 
	ALTER TABLE [dbo].[T_TANITASIORA] DROP CONSTRAINT [FK_4025623_4025622];


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_4025633_4025631]...';


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_HAZIFELADATOK] DROP CONSTRAINT [FK_4028129_4028127];


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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_4025668_4025666]...';


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


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_4028380_4028379]...';


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


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


GO
ALTER TABLE [dbo].[T_TANULOERTEKELESLATTAMOZAS] DROP CONSTRAINT [FK_4028054_4028052];


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_ELFOGADOTTETTF]            CHAR (1)       DEFAULT ('F') NOT NULL,
    [C_INTEZMENYID]               INT            NOT NULL,
    [C_TANEVID]                   INT            NOT NULL,
    [TOROLT]                      CHAR (1)       DEFAULT ('F') NOT NULL,
    [SERIAL]                      INT            DEFAULT ((0)) NOT NULL,
    [LASTCHANGED]                 DATETIME       DEFAULT (getdate()) NOT NULL,
    [CREATED]                     DATETIME       DEFAULT (getdate()) NOT NULL,
    [MODIFIER]                    INT            NULL,
    [CREATOR]                     INT            NULL,
    [ELOZOTANEVIREKORDID]         INT            NULL,
    [NNID]                        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_SZAKBEIRATKFELVETT], [C_SZAKBEIRATKJELENTKEZETT], [C_INTEZMENYID], [C_TANEVID], [TOROLT], [SERIAL], [LASTCHANGED], [CREATED], [MODIFIER], [CREATOR], [ELOZOTANEVIREKORDID], [NNID])
        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_SZAKBEIRATKFELVETT],
                 [C_SZAKBEIRATKJELENTKEZETT],
                 [C_INTEZMENYID],
                 [C_TANEVID],
                 [TOROLT],
                 [SERIAL],
                 [LASTCHANGED],
                 [CREATED],
                 [MODIFIER],
                 [CREATOR],
                 [ELOZOTANEVIREKORDID],
                 [NNID]
        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_ORARENDIORA]...';


GO
BEGIN TRANSACTION;

SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;

SET XACT_ABORT ON;

CREATE TABLE [dbo].[tmp_ms_xx_T_ORARENDIORA] (
    [ID]                         INT      IDENTITY (1, 1) NOT NULL,
    [C_DIFFERENCIALT]            CHAR (1) DEFAULT ('F') NULL,
    [C_DRAMA]                    CHAR (1) DEFAULT ('F') NULL,
    [C_HETIREND]                 INT      NOT NULL,
    [C_HETNAPJA]                 INT      NOT NULL,
    [C_IKTTANORA]                CHAR (1) DEFAULT ('F') NULL,
    [C_IPRTANORA]                CHAR (1) DEFAULT ('F') NULL,
    [C_KOOPERATIV]               CHAR (1) DEFAULT ('F') NULL,
    [C_MERES]                    CHAR (1) DEFAULT ('F') NULL,
    [C_MINDENNAPOSTESTNEVELES]   CHAR (1) DEFAULT ('F') NULL,
    [C_NEMSZAKRENDSZERUORA]      CHAR (1) DEFAULT ('F') NULL,
    [C_NEMZETISEGIORA]           CHAR (1) DEFAULT ('F') NULL,
    [C_ORASZAM]                  INT      NULL,
    [C_SORSZAMOZANDO]            CHAR (1) DEFAULT ('T') NULL,
    [C_TAMOPORA]                 CHAR (1) DEFAULT ('F') NULL,
    [C_TULORA]                   CHAR (1) DEFAULT ('F') NULL,
    [C_BONTOTT]                  CHAR (1) NULL,
    [C_ORAERVENYESSEGKEZDETE]    DATETIME NOT NULL,
    [C_ORAERVENYESSEGVEGE]       DATETIME NULL,
    [C_PARHUZAMOSORA]            CHAR (1) DEFAULT ('F') NULL,
    [C_TIOP12]                   CHAR (1) DEFAULT ('F') NULL,
    [C_ORAKEZDETE]               DATETIME NULL,
    [C_ORAVEGE]                  DATETIME NULL,
    [C_TANORANKIVULIFOGLALKOZAS] CHAR (1) DEFAULT ('F') NULL,
    [C_IMPORTALT]                CHAR (1) DEFAULT ('F') NOT NULL,
    [C_CSENGETESIRENDID]         INT      NULL,
    [C_CSENGETESIRENDORAID]      INT      NULL,
    [C_ORARENDIORAGROUPID]       INT      NULL,
    [C_EFOP32317]                CHAR (1) DEFAULT ('F') NOT NULL,
    [C_MULTIKULTURALISORA]       CHAR (1) DEFAULT ('F') NOT NULL,
    [C_TEREMID]                  INT      NULL,
    [C_FOGLALKOZASID]            INT      NULL,
    [C_TANTARGYID]               INT      NULL,
    [C_OSZTALYCSOPORTID]         INT      NULL,
    [C_TANARID]                  INT      NULL,
    [C_ORATULAJDONOSID]          INT      NULL,
    [C_INTEZMENYID]              INT      NOT NULL,
    [C_TANEVID]                  INT      NOT NULL,
    [TOROLT]                     CHAR (1) DEFAULT ('F') NOT NULL,
    [SERIAL]                     INT      DEFAULT ((0)) NOT NULL,
    [LASTCHANGED]                DATETIME DEFAULT (getdate()) NOT NULL,
    [CREATED]                    DATETIME DEFAULT (getdate()) NOT NULL,
    [MODIFIER]                   INT      NULL,
    [CREATOR]                    INT      NULL,
    [ELOZOTANEVIREKORDID]        INT      NULL,
    [NNID]                       INT      NULL,
    CONSTRAINT [tmp_ms_xx_constraint_PK_T_40255301] PRIMARY KEY CLUSTERED ([ID] ASC)
);

IF EXISTS (SELECT TOP 1 1 
           FROM   [dbo].[T_ORARENDIORA])
    BEGIN
        SET IDENTITY_INSERT [dbo].[tmp_ms_xx_T_ORARENDIORA] ON;
        INSERT INTO [dbo].[tmp_ms_xx_T_ORARENDIORA] ([ID], [C_DIFFERENCIALT], [C_DRAMA], [C_HETIREND], [C_HETNAPJA], [C_IKTTANORA], [C_IPRTANORA], [C_KOOPERATIV], [C_MERES], [C_MINDENNAPOSTESTNEVELES], [C_NEMSZAKRENDSZERUORA], [C_NEMZETISEGIORA], [C_ORASZAM], [C_SORSZAMOZANDO], [C_TAMOPORA], [C_TULORA], [C_BONTOTT], [C_ORAERVENYESSEGKEZDETE], [C_ORAERVENYESSEGVEGE], [C_PARHUZAMOSORA], [C_TIOP12], [C_ORAKEZDETE], [C_ORAVEGE], [C_TANORANKIVULIFOGLALKOZAS], [C_IMPORTALT], [C_CSENGETESIRENDID], [C_CSENGETESIRENDORAID], [C_ORARENDIORAGROUPID], [C_TEREMID], [C_FOGLALKOZASID], [C_TANTARGYID], [C_OSZTALYCSOPORTID], [C_TANARID], [C_ORATULAJDONOSID], [C_INTEZMENYID], [C_TANEVID], [TOROLT], [SERIAL], [LASTCHANGED], [CREATED], [MODIFIER], [CREATOR], [ELOZOTANEVIREKORDID], [NNID])
        SELECT   [ID],
                 [C_DIFFERENCIALT],
                 [C_DRAMA],
                 [C_HETIREND],
                 [C_HETNAPJA],
                 [C_IKTTANORA],
                 [C_IPRTANORA],
                 [C_KOOPERATIV],
                 [C_MERES],
                 [C_MINDENNAPOSTESTNEVELES],
                 [C_NEMSZAKRENDSZERUORA],
                 [C_NEMZETISEGIORA],
                 [C_ORASZAM],
                 [C_SORSZAMOZANDO],
                 [C_TAMOPORA],
                 [C_TULORA],
                 [C_BONTOTT],
                 [C_ORAERVENYESSEGKEZDETE],
                 [C_ORAERVENYESSEGVEGE],
                 [C_PARHUZAMOSORA],
                 [C_TIOP12],
                 [C_ORAKEZDETE],
                 [C_ORAVEGE],
                 [C_TANORANKIVULIFOGLALKOZAS],
                 [C_IMPORTALT],
                 [C_CSENGETESIRENDID],
                 [C_CSENGETESIRENDORAID],
                 [C_ORARENDIORAGROUPID],
                 [C_TEREMID],
                 [C_FOGLALKOZASID],
                 [C_TANTARGYID],
                 [C_OSZTALYCSOPORTID],
                 [C_TANARID],
                 [C_ORATULAJDONOSID],
                 [C_INTEZMENYID],
                 [C_TANEVID],
                 [TOROLT],
                 [SERIAL],
                 [LASTCHANGED],
                 [CREATED],
                 [MODIFIER],
                 [CREATOR],
                 [ELOZOTANEVIREKORDID],
                 [NNID]
        FROM     [dbo].[T_ORARENDIORA]
        ORDER BY [ID] ASC;
        SET IDENTITY_INSERT [dbo].[tmp_ms_xx_T_ORARENDIORA] OFF;
    END

DROP TABLE [dbo].[T_ORARENDIORA];

EXECUTE sp_rename N'[dbo].[tmp_ms_xx_T_ORARENDIORA]', N'T_ORARENDIORA';

EXECUTE sp_rename N'[dbo].[tmp_ms_xx_constraint_PK_T_40255301]', N'PK_T_4025530', N'OBJECT';

COMMIT TRANSACTION;

SET TRANSACTION ISOLATION LEVEL READ COMMITTED;


GO
PRINT N'Creating [dbo].[T_ORARENDIORA].[I_T_4025530_4025533]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025530_4025533]
    ON [dbo].[T_ORARENDIORA]([C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_HETIREND] ASC);


GO
PRINT N'Creating [dbo].[T_ORARENDIORA].[I_T_4025530_4025534]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025530_4025534]
    ON [dbo].[T_ORARENDIORA]([C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_HETNAPJA] ASC);


GO
PRINT N'Creating [dbo].[T_ORARENDIORA].[I_T_4025550_4025549]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025550_4025549]
    ON [dbo].[T_ORARENDIORA]([C_TEREMID] ASC);


GO
PRINT N'Creating [dbo].[T_ORARENDIORA].[I_T_4025554_4025552]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025554_4025552]
    ON [dbo].[T_ORARENDIORA]([C_FOGLALKOZASID] ASC);


GO
PRINT N'Creating [dbo].[T_ORARENDIORA].[I_T_4026321_4026319]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4026321_4026319]
    ON [dbo].[T_ORARENDIORA]([C_TANTARGYID] ASC);


GO
PRINT N'Creating [dbo].[T_ORARENDIORA].[I_T_4026324_4026322]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4026324_4026322]
    ON [dbo].[T_ORARENDIORA]([C_OSZTALYCSOPORTID] ASC);


GO
PRINT N'Creating [dbo].[T_ORARENDIORA].[I_T_4026327_4026325]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4026327_4026325]
    ON [dbo].[T_ORARENDIORA]([C_TANARID] ASC);


GO
PRINT N'Creating [dbo].[T_ORARENDIORA].[I_T_4026329_4026328]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4026329_4026328]
    ON [dbo].[T_ORARENDIORA]([C_ORATULAJDONOSID] ASC);


GO
PRINT N'Creating [dbo].[T_ORARENDIORA].[I_T_402553002_402553000]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402553002_402553000]
    ON [dbo].[T_ORARENDIORA]([C_INTEZMENYID] ASC);


GO
PRINT N'Creating [dbo].[T_ORARENDIORA].[I_T_402553005_402553003]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402553005_402553003]
    ON [dbo].[T_ORARENDIORA]([C_TANEVID] ASC);


GO
PRINT N'Creating [dbo].[T_ORARENDIORA].[IX_ORARENDIORA_INTEZMENYID_TANEVID_OSZTALYCSOPORTID]...';


GO
CREATE NONCLUSTERED INDEX [IX_ORARENDIORA_INTEZMENYID_TANEVID_OSZTALYCSOPORTID]
    ON [dbo].[T_ORARENDIORA]([C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_OSZTALYCSOPORTID] ASC)
    INCLUDE([TOROLT], [C_HETIREND], [C_HETNAPJA], [C_ORAERVENYESSEGKEZDETE], [C_ORAERVENYESSEGVEGE]);


GO
PRINT N'Creating [dbo].[T_ORARENDIORA].[IX_ORARENDIORA_INTEZMENYID_TANEVID_CSENGETESIRENDID_ORAERVENYESSEGVEGE]...';


GO
CREATE NONCLUSTERED INDEX [IX_ORARENDIORA_INTEZMENYID_TANEVID_CSENGETESIRENDID_ORAERVENYESSEGVEGE]
    ON [dbo].[T_ORARENDIORA]([C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_CSENGETESIRENDID] ASC, [C_ORAERVENYESSEGVEGE] ASC)
    INCLUDE([TOROLT], [C_OSZTALYCSOPORTID]);


GO
PRINT N'Creating [dbo].[T_ORARENDIORA].[IX_ORARENDIORA_ORARENDIORAGROUPID_ORAERVENYESSEGKEZDETE_TANEVID_INTEZMENYID]...';


GO
CREATE NONCLUSTERED INDEX [IX_ORARENDIORA_ORARENDIORAGROUPID_ORAERVENYESSEGKEZDETE_TANEVID_INTEZMENYID]
    ON [dbo].[T_ORARENDIORA]([C_ORARENDIORAGROUPID] ASC, [C_ORAERVENYESSEGKEZDETE] ASC, [C_TANEVID] ASC, [C_INTEZMENYID] ASC)
    INCLUDE([C_ORAERVENYESSEGVEGE]) WHERE ([TOROLT]='F');


GO
PRINT N'Creating [dbo].[T_ORARENDIORA].[IX_ORARENDIORA_TANARID_ORAERVENYESSEGKEZDETE_ORAERVENYESSEGVEGE_INTEZMENYID_TANEVID]...';


GO
CREATE NONCLUSTERED INDEX [IX_ORARENDIORA_TANARID_ORAERVENYESSEGKEZDETE_ORAERVENYESSEGVEGE_INTEZMENYID_TANEVID]
    ON [dbo].[T_ORARENDIORA]([C_TANARID] ASC, [C_ORAERVENYESSEGKEZDETE] ASC, [C_ORAERVENYESSEGVEGE] ASC, [C_INTEZMENYID] ASC, [C_TANEVID] ASC)
    INCLUDE([C_OSZTALYCSOPORTID]) WHERE ([TOROLT]='F');


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


GO
BEGIN TRANSACTION;

SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;

SET XACT_ABORT ON;

CREATE TABLE [dbo].[tmp_ms_xx_T_OSZTALY] (
    [ID]                          INT            NOT NULL,
    [C_KEPZESIFORMA]              INT            NOT NULL,
    [C_OSZTALYNAPLOLEIRASA]       NVARCHAR (MAX) NULL,
    [C_OSZTALYNAPLOMEGNYITASA]    DATETIME       NULL,
    [C_OSZTALYNAPLOZARASA]        DATETIME       NULL,
    [C_AGAZAT]                    INT            NULL,
    [C_RESZSZAKKEPESITES]         INT            NULL,
    [C_SZAKKEPESITES]             INT            NULL,
    [C_SZAKMACSOPORT]             INT            NULL,
    [C_TECHNIKAIOSZTALY]          CHAR (1)       DEFAULT ('F') NOT NULL,
    [C_GIMNAZIUMIEVFOLYAMTIPUSID] INT            NULL,
    [C_GYOGYPEDAGOGIAI]           CHAR (1)       DEFAULT ('F') NOT NULL,
    [C_KETTANNYELVU]              CHAR (1)       DEFAULT ('F') NOT NULL,
    [C_LOGOPEDIAI]                CHAR (1)       DEFAULT ('F') NOT NULL,
    [C_NEMZETISEGI]               CHAR (1)       DEFAULT ('F') NOT NULL,
    [C_NYELVIELOKESZITO]          CHAR (1)       DEFAULT ('F') NOT NULL,
    [C_SPORT]                     CHAR (1)       DEFAULT ('F') NOT NULL,
    [C_AJTEHETTSEGGONDOZOPROGRAM] CHAR (1)       DEFAULT ('F') NOT NULL,
    [C_AJPROGRAM]                 CHAR (1)       DEFAULT ('F') NOT NULL,
    [C_VEGYESEVFOLYAMU]           CHAR (1)       DEFAULT ('F') NOT NULL,
    [C_VEGYESSZAKKEPZESU]         CHAR (1)       DEFAULT ('F') NOT NULL,
    [C_OSZTALYFONOKID]            INT            NULL,
    [C_OFOHELYETTESID]            INT            NULL,
    [C_TANTERVID]                 INT            NULL,
    [C_ALINTEZMENYID]             INT            NOT NULL,
    [C_ALTANEVID]                 INT            NOT NULL,
    [TOROLT]                      CHAR (1)       DEFAULT ('F') NOT NULL,
    [SERIAL]                      INT            DEFAULT ((0)) NOT NULL,
    [LASTCHANGED]                 DATETIME       DEFAULT (getdate()) NOT NULL,
    [CREATED]                     DATETIME       DEFAULT (getdate()) NOT NULL,
    [MODIFIER]                    INT            NULL,
    [CREATOR]                     INT            NULL,
    [ELOZOTANEVIREKORDID]         INT            NULL,
    [ELOZOTANEVIREKORDIDA]        INT            NULL,
    [NNID]                        INT            NULL,
    CONSTRAINT [tmp_ms_xx_constraint_PK_T_40252941] PRIMARY KEY CLUSTERED ([ID] ASC)
);

IF EXISTS (SELECT TOP 1 1 
           FROM   [dbo].[T_OSZTALY])
    BEGIN
        INSERT INTO [dbo].[tmp_ms_xx_T_OSZTALY] ([ID], [C_KEPZESIFORMA], [C_OSZTALYNAPLOLEIRASA], [C_OSZTALYNAPLOMEGNYITASA], [C_OSZTALYNAPLOZARASA], [C_AGAZAT], [C_RESZSZAKKEPESITES], [C_SZAKKEPESITES], [C_SZAKMACSOPORT], [C_TECHNIKAIOSZTALY], [C_GIMNAZIUMIEVFOLYAMTIPUSID], [C_GYOGYPEDAGOGIAI], [C_KETTANNYELVU], [C_LOGOPEDIAI], [C_NEMZETISEGI], [C_NYELVIELOKESZITO], [C_SPORT], [C_AJTEHETTSEGGONDOZOPROGRAM], [C_OSZTALYFONOKID], [C_OFOHELYETTESID], [C_TANTERVID], [C_ALINTEZMENYID], [C_ALTANEVID], [TOROLT], [SERIAL], [LASTCHANGED], [CREATED], [MODIFIER], [CREATOR], [ELOZOTANEVIREKORDID], [ELOZOTANEVIREKORDIDA], [NNID])
        SELECT   [ID],
                 [C_KEPZESIFORMA],
                 [C_OSZTALYNAPLOLEIRASA],
                 [C_OSZTALYNAPLOMEGNYITASA],
                 [C_OSZTALYNAPLOZARASA],
                 [C_AGAZAT],
                 [C_RESZSZAKKEPESITES],
                 [C_SZAKKEPESITES],
                 [C_SZAKMACSOPORT],
                 [C_TECHNIKAIOSZTALY],
                 [C_GIMNAZIUMIEVFOLYAMTIPUSID],
                 [C_GYOGYPEDAGOGIAI],
                 [C_KETTANNYELVU],
                 [C_LOGOPEDIAI],
                 [C_NEMZETISEGI],
                 [C_NYELVIELOKESZITO],
                 [C_SPORT],
                 [C_AJTEHETTSEGGONDOZOPROGRAM],
                 [C_OSZTALYFONOKID],
                 [C_OFOHELYETTESID],
                 [C_TANTERVID],
                 [C_ALINTEZMENYID],
                 [C_ALTANEVID],
                 [TOROLT],
                 [SERIAL],
                 [LASTCHANGED],
                 [CREATED],
                 [MODIFIER],
                 [CREATOR],
                 [ELOZOTANEVIREKORDID],
                 [ELOZOTANEVIREKORDIDA],
                 [NNID]
        FROM     [dbo].[T_OSZTALY]
        ORDER BY [ID] ASC;
    END

DROP TABLE [dbo].[T_OSZTALY];

EXECUTE sp_rename N'[dbo].[tmp_ms_xx_T_OSZTALY]', N'T_OSZTALY';

EXECUTE sp_rename N'[dbo].[tmp_ms_xx_constraint_PK_T_40252941]', N'PK_T_4025294', N'OBJECT';

COMMIT TRANSACTION;

SET TRANSACTION ISOLATION LEVEL READ COMMITTED;


GO
PRINT N'Creating [dbo].[T_OSZTALY].[I_T_4025294_4025295]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025294_4025295]
    ON [dbo].[T_OSZTALY]([C_ALINTEZMENYID] ASC, [C_ALTANEVID] ASC, [C_KEPZESIFORMA] ASC);


GO
PRINT N'Creating [dbo].[T_OSZTALY].[I_T_4025294_4027544]...';


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


GO
PRINT N'Creating [dbo].[T_OSZTALY].[I_T_4025294_4027545]...';


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


GO
PRINT N'Creating [dbo].[T_OSZTALY].[I_T_4025294_4027546]...';


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


GO
PRINT N'Creating [dbo].[T_OSZTALY].[I_T_4025294_4027547]...';


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


GO
PRINT N'Creating [dbo].[T_OSZTALY].[I_T_4025294_4028299]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025294_4028299]
    ON [dbo].[T_OSZTALY]([C_ALINTEZMENYID] ASC, [C_ALTANEVID] ASC, [C_GIMNAZIUMIEVFOLYAMTIPUSID] ASC);


GO
PRINT N'Creating [dbo].[T_OSZTALY].[I_T_4025320_4025319]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025320_4025319]
    ON [dbo].[T_OSZTALY]([C_OSZTALYFONOKID] ASC);


GO
PRINT N'Creating [dbo].[T_OSZTALY].[I_T_4025323_4025322]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025323_4025322]
    ON [dbo].[T_OSZTALY]([C_OFOHELYETTESID] ASC);


GO
PRINT N'Creating [dbo].[T_OSZTALY].[I_T_4025421_4025419]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025421_4025419]
    ON [dbo].[T_OSZTALY]([C_TANTERVID] ASC);


GO
PRINT N'Creating [dbo].[T_OSZTALY].[I_T_402529402_402529400]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402529402_402529400]
    ON [dbo].[T_OSZTALY]([C_ALINTEZMENYID] ASC);


GO
PRINT N'Creating [dbo].[T_OSZTALY].[I_T_402529405_402529403]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402529405_402529403]
    ON [dbo].[T_OSZTALY]([C_ALTANEVID] ASC);


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


GO
BEGIN TRANSACTION;

SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;

SET XACT_ABORT ON;

CREATE TABLE [dbo].[tmp_ms_xx_T_TANITASIORA] (
    [ID]                         INT             IDENTITY (1, 1) NOT NULL,
    [C_BEJEGYZESIDEJE]           DATETIME        NOT NULL,
    [C_BONTOTT]                  CHAR (1)        DEFAULT ('F') NULL,
    [C_DATUM]                    DATETIME        NOT NULL,
    [C_HELYETTESITESOKA]         NVARCHAR (255)  NULL,
    [C_HELYETTESITESTIPUSA]      INT             NULL,
    [C_HETNAPJA]                 INT             NOT NULL,
    [C_HETSORSZAMA]              INT             NOT NULL,
    [C_IKTTANORA]                CHAR (1)        DEFAULT ('F') NULL,
    [C_MEGJEGYZES]               NVARCHAR (255)  NULL,
    [C_MEGTARTOTT]               CHAR (1)        DEFAULT ('T') NULL,
    [C_NAPSORSZAMA]              INT             NOT NULL,
    [C_NEMSZAKRENDSZERUORA]      CHAR (1)        DEFAULT ('F') NULL,
    [C_ORAKEZDETE]               DATETIME        NOT NULL,
    [C_ORASZAM]                  INT             NULL,
    [C_ORAVEGE]                  DATETIME        NOT NULL,
    [C_SORSZAMOZANDO]            CHAR (1)        NULL,
    [C_TAMOPORA]                 CHAR (1)        DEFAULT ('F') NULL,
    [C_TEMA]                     NVARCHAR (1000) NULL,
    [C_TULORA]                   CHAR (1)        DEFAULT ('F') NULL,
    [C_OSZTALYFONOKI]            CHAR (1)        DEFAULT ('F') NULL,
    [C_TANORANKIVULIFOGLALKOZAS] CHAR (1)        DEFAULT ('F') NULL,
    [C_HAZIFELADAT]              NVARCHAR (MAX)  NULL,
    [C_DIFFERENCIALT]            CHAR (1)        NULL,
    [C_DRAMA]                    CHAR (1)        NULL,
    [C_IPRTANORA]                CHAR (1)        NULL,
    [C_KOOPERATIV]               CHAR (1)        NULL,
    [C_MERES]                    CHAR (1)        NULL,
    [C_MINDENNAPOSTESTNEVELES]   CHAR (1)        NULL,
    [C_NEMZETISEGIORA]           CHAR (1)        NULL,
    [C_PARHUZAMOSORA]            CHAR (1)        NULL,
    [C_TIOP12]                   CHAR (1)        NULL,
    [C_ADMINALTALKIIRT]          CHAR (1)        NULL,
    [C_CSENGETESIRENDID]         INT             NULL,
    [C_CSENGETESIRENDORAID]      INT             NULL,
    [C_ORAOSSZEVONASID]          INT             NULL,
    [C_ORARENDIORAGROUPID]       INT             NULL,
    [C_MOBILNAPLOZOTT]           CHAR (1)        DEFAULT ('F') NOT NULL,
    [C_EFOP32317]                CHAR (1)        DEFAULT ('F') NOT NULL,
    [C_MULTIKULTURALISORA]       CHAR (1)        DEFAULT ('F') NOT NULL,
    [C_TANMENETID]               INT             NULL,
    [C_TANTARGYID]               INT             NULL,
    [C_NAPTARINAPID]             INT             NULL,
    [C_ORARENDIORAID]            INT             NULL,
    [C_FOGLALKOZASID]            INT             NULL,
    [C_HELYETTESITOTANARID]      INT             NULL,
    [C_TANARID]                  INT             NOT NULL,
    [C_TEREMID]                  INT             NULL,
    [C_OSZTALYCSOPORTID]         INT             NULL,
    [C_ORATULAJDONOSID]          INT             NOT NULL,
    [C_UPLOADEDFILEID]           INT             NULL,
    [C_INTEZMENYID]              INT             NOT NULL,
    [C_TANEVID]                  INT             NOT NULL,
    [TOROLT]                     CHAR (1)        DEFAULT ('F') NOT NULL,
    [SERIAL]                     INT             DEFAULT ((0)) NOT NULL,
    [LASTCHANGED]                DATETIME        DEFAULT (getdate()) NOT NULL,
    [CREATED]                    DATETIME        DEFAULT (getdate()) NOT NULL,
    [MODIFIER]                   INT             NULL,
    [CREATOR]                    INT             NULL,
    [ELOZOTANEVIREKORDID]        INT             NULL,
    [NNID]                       INT             NULL,
    CONSTRAINT [tmp_ms_xx_constraint_PK_T_40255751] PRIMARY KEY CLUSTERED ([ID] ASC)
);

IF EXISTS (SELECT TOP 1 1 
           FROM   [dbo].[T_TANITASIORA])
    BEGIN
        SET IDENTITY_INSERT [dbo].[tmp_ms_xx_T_TANITASIORA] ON;
        INSERT INTO [dbo].[tmp_ms_xx_T_TANITASIORA] ([ID], [C_BEJEGYZESIDEJE], [C_BONTOTT], [C_DATUM], [C_HELYETTESITESOKA], [C_HELYETTESITESTIPUSA], [C_HETNAPJA], [C_HETSORSZAMA], [C_IKTTANORA], [C_MEGJEGYZES], [C_MEGTARTOTT], [C_NAPSORSZAMA], [C_NEMSZAKRENDSZERUORA], [C_ORAKEZDETE], [C_ORASZAM], [C_ORAVEGE], [C_SORSZAMOZANDO], [C_TAMOPORA], [C_TEMA], [C_TULORA], [C_OSZTALYFONOKI], [C_TANORANKIVULIFOGLALKOZAS], [C_HAZIFELADAT], [C_DIFFERENCIALT], [C_DRAMA], [C_IPRTANORA], [C_KOOPERATIV], [C_MERES], [C_MINDENNAPOSTESTNEVELES], [C_NEMZETISEGIORA], [C_PARHUZAMOSORA], [C_TIOP12], [C_ADMINALTALKIIRT], [C_CSENGETESIRENDID], [C_CSENGETESIRENDORAID], [C_ORAOSSZEVONASID], [C_ORARENDIORAGROUPID], [C_MOBILNAPLOZOTT], [C_TANMENETID], [C_TANTARGYID], [C_NAPTARINAPID], [C_ORARENDIORAID], [C_FOGLALKOZASID], [C_HELYETTESITOTANARID], [C_TANARID], [C_TEREMID], [C_OSZTALYCSOPORTID], [C_ORATULAJDONOSID], [C_UPLOADEDFILEID], [C_INTEZMENYID], [C_TANEVID], [TOROLT], [SERIAL], [LASTCHANGED], [CREATED], [MODIFIER], [CREATOR], [ELOZOTANEVIREKORDID], [NNID])
        SELECT   [ID],
                 [C_BEJEGYZESIDEJE],
                 [C_BONTOTT],
                 [C_DATUM],
                 [C_HELYETTESITESOKA],
                 [C_HELYETTESITESTIPUSA],
                 [C_HETNAPJA],
                 [C_HETSORSZAMA],
                 [C_IKTTANORA],
                 [C_MEGJEGYZES],
                 [C_MEGTARTOTT],
                 [C_NAPSORSZAMA],
                 [C_NEMSZAKRENDSZERUORA],
                 [C_ORAKEZDETE],
                 [C_ORASZAM],
                 [C_ORAVEGE],
                 [C_SORSZAMOZANDO],
                 [C_TAMOPORA],
                 [C_TEMA],
                 [C_TULORA],
                 [C_OSZTALYFONOKI],
                 [C_TANORANKIVULIFOGLALKOZAS],
                 [C_HAZIFELADAT],
                 [C_DIFFERENCIALT],
                 [C_DRAMA],
                 [C_IPRTANORA],
                 [C_KOOPERATIV],
                 [C_MERES],
                 [C_MINDENNAPOSTESTNEVELES],
                 [C_NEMZETISEGIORA],
                 [C_PARHUZAMOSORA],
                 [C_TIOP12],
                 [C_ADMINALTALKIIRT],
                 [C_CSENGETESIRENDID],
                 [C_CSENGETESIRENDORAID],
                 [C_ORAOSSZEVONASID],
                 [C_ORARENDIORAGROUPID],
                 [C_MOBILNAPLOZOTT],
                 [C_TANMENETID],
                 [C_TANTARGYID],
                 [C_NAPTARINAPID],
                 [C_ORARENDIORAID],
                 [C_FOGLALKOZASID],
                 [C_HELYETTESITOTANARID],
                 [C_TANARID],
                 [C_TEREMID],
                 [C_OSZTALYCSOPORTID],
                 [C_ORATULAJDONOSID],
                 [C_UPLOADEDFILEID],
                 [C_INTEZMENYID],
                 [C_TANEVID],
                 [TOROLT],
                 [SERIAL],
                 [LASTCHANGED],
                 [CREATED],
                 [MODIFIER],
                 [CREATOR],
                 [ELOZOTANEVIREKORDID],
                 [NNID]
        FROM     [dbo].[T_TANITASIORA]
        ORDER BY [ID] ASC;
        SET IDENTITY_INSERT [dbo].[tmp_ms_xx_T_TANITASIORA] OFF;
    END

DROP TABLE [dbo].[T_TANITASIORA];

EXECUTE sp_rename N'[dbo].[tmp_ms_xx_T_TANITASIORA]', N'T_TANITASIORA';

EXECUTE sp_rename N'[dbo].[tmp_ms_xx_constraint_PK_T_40255751]', N'PK_T_4025575', N'OBJECT';

COMMIT TRANSACTION;

SET TRANSACTION ISOLATION LEVEL READ COMMITTED;


GO
PRINT N'Creating [dbo].[T_TANITASIORA].[I_T_4025575_4025580]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025575_4025580]
    ON [dbo].[T_TANITASIORA]([C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_HELYETTESITESTIPUSA] ASC);


GO
PRINT N'Creating [dbo].[T_TANITASIORA].[I_T_4025575_4025581]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025575_4025581]
    ON [dbo].[T_TANITASIORA]([C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_HETNAPJA] ASC);


GO
PRINT N'Creating [dbo].[T_TANITASIORA].[I_T_4025602_4025601]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025602_4025601]
    ON [dbo].[T_TANITASIORA]([C_TANMENETID] ASC);


GO
PRINT N'Creating [dbo].[T_TANITASIORA].[I_T_4025608_4025607]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025608_4025607]
    ON [dbo].[T_TANITASIORA]([C_TANTARGYID] ASC);


GO
PRINT N'Creating [dbo].[T_TANITASIORA].[I_T_4025611_4025610]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025611_4025610]
    ON [dbo].[T_TANITASIORA]([C_NAPTARINAPID] ASC);


GO
PRINT N'Creating [dbo].[T_TANITASIORA].[I_T_4025620_4025619]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025620_4025619]
    ON [dbo].[T_TANITASIORA]([C_ORARENDIORAID] ASC);


GO
PRINT N'Creating [dbo].[T_TANITASIORA].[I_T_4025623_4025622]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025623_4025622]
    ON [dbo].[T_TANITASIORA]([C_FOGLALKOZASID] ASC);


GO
PRINT N'Creating [dbo].[T_TANITASIORA].[I_T_4025629_4025628]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025629_4025628]
    ON [dbo].[T_TANITASIORA]([C_HELYETTESITOTANARID] ASC);


GO
PRINT N'Creating [dbo].[T_TANITASIORA].[I_T_4025633_4025631]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025633_4025631]
    ON [dbo].[T_TANITASIORA]([C_TANARID] ASC);


GO
PRINT N'Creating [dbo].[T_TANITASIORA].[I_T_4025635_4025634]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025635_4025634]
    ON [dbo].[T_TANITASIORA]([C_TEREMID] ASC);


GO
PRINT N'Creating [dbo].[T_TANITASIORA].[I_T_4025638_4025637]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025638_4025637]
    ON [dbo].[T_TANITASIORA]([C_OSZTALYCSOPORTID] ASC);


GO
PRINT N'Creating [dbo].[T_TANITASIORA].[I_T_4026315_4026314]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4026315_4026314]
    ON [dbo].[T_TANITASIORA]([C_ORATULAJDONOSID] ASC);


GO
PRINT N'Creating [dbo].[T_TANITASIORA].[I_T_4027901_4027900]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4027901_4027900]
    ON [dbo].[T_TANITASIORA]([C_UPLOADEDFILEID] ASC);


GO
PRINT N'Creating [dbo].[T_TANITASIORA].[I_T_402557502_402557500]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402557502_402557500]
    ON [dbo].[T_TANITASIORA]([C_INTEZMENYID] ASC);


GO
PRINT N'Creating [dbo].[T_TANITASIORA].[I_T_402557505_402557503]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402557505_402557503]
    ON [dbo].[T_TANITASIORA]([C_TANEVID] ASC);


GO
PRINT N'Creating [dbo].[T_TANITASIORA].[IDX_TANITASIORA_NAPTARINAPID_ORASZAM]...';


GO
CREATE NONCLUSTERED INDEX [IDX_TANITASIORA_NAPTARINAPID_ORASZAM]
    ON [dbo].[T_TANITASIORA]([C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_NAPTARINAPID] ASC, [C_ORASZAM] ASC);


GO
PRINT N'Creating [dbo].[T_TANITASIORA].[IDX_TANITASIORA_NAPTARINAPID_TANTARGYID_OSZTALYCSOPORTID]...';


GO
CREATE NONCLUSTERED INDEX [IDX_TANITASIORA_NAPTARINAPID_TANTARGYID_OSZTALYCSOPORTID]
    ON [dbo].[T_TANITASIORA]([C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_NAPTARINAPID] ASC, [C_TANTARGYID] ASC, [C_OSZTALYCSOPORTID] ASC);


GO
PRINT N'Creating [dbo].[T_TANITASIORA].[IX_TANITASIORA_INTEZMENYID_TANEVID_OSZTALYCSOPORTID_TANTARGYID]...';


GO
CREATE NONCLUSTERED INDEX [IX_TANITASIORA_INTEZMENYID_TANEVID_OSZTALYCSOPORTID_TANTARGYID]
    ON [dbo].[T_TANITASIORA]([C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_OSZTALYCSOPORTID] ASC, [C_TANTARGYID] ASC)
    INCLUDE([TOROLT], [C_DATUM]);


GO
PRINT N'Creating [dbo].[T_TANITASIORA].[IX_TANITASIORA_INTEZMENYID_TANEVID_DATUM_TANARID_HELYETTESITOTANARID]...';


GO
CREATE NONCLUSTERED INDEX [IX_TANITASIORA_INTEZMENYID_TANEVID_DATUM_TANARID_HELYETTESITOTANARID]
    ON [dbo].[T_TANITASIORA]([C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_DATUM] ASC, [C_TANARID] ASC, [C_HELYETTESITOTANARID] ASC)
    INCLUDE([TOROLT]);


GO
PRINT N'Creating [dbo].[T_TANITASIORA].[IX_TANITASIORA_DATUM_INTEZMENYID]...';


GO
CREATE NONCLUSTERED INDEX [IX_TANITASIORA_DATUM_INTEZMENYID]
    ON [dbo].[T_TANITASIORA]([C_DATUM] ASC, [C_INTEZMENYID] ASC)
    INCLUDE([C_ORARENDIORAGROUPID], [C_TANEVID]) WHERE ([TOROLT]='F');


GO
PRINT N'Creating [dbo].[T_TANITASIORA].[IX_TANITASIORA_TANEVID_ORAKEZDETE_ORAVEGE]...';


GO
CREATE NONCLUSTERED INDEX [IX_TANITASIORA_TANEVID_ORAKEZDETE_ORAVEGE]
    ON [dbo].[T_TANITASIORA]([C_TANEVID] ASC, [C_ORAKEZDETE] ASC, [C_ORAVEGE] ASC)
    INCLUDE([C_INTEZMENYID]) WHERE ([TOROLT]='F');


GO
PRINT N'Creating [dbo].[T_TANITASIORA].[IX_TANITASIORA_DATUM_TANARID_OSZTALYCSOPORTID_INTEZMENYID_TANEVID]...';


GO
CREATE NONCLUSTERED INDEX [IX_TANITASIORA_DATUM_TANARID_OSZTALYCSOPORTID_INTEZMENYID_TANEVID]
    ON [dbo].[T_TANITASIORA]([C_DATUM] ASC, [C_TANARID] ASC, [C_OSZTALYCSOPORTID] ASC, [C_INTEZMENYID] ASC, [C_TANEVID] ASC) WHERE ([TOROLT]='F');


GO
PRINT N'Creating [dbo].[T_TANITASIORA].[IX_TANITASIORA_DATUM_HELYETTESITOTANARID_OSZTALYCSOPORTID_INTEZMENYID_TANEVID]...';


GO
CREATE NONCLUSTERED INDEX [IX_TANITASIORA_DATUM_HELYETTESITOTANARID_OSZTALYCSOPORTID_INTEZMENYID_TANEVID]
    ON [dbo].[T_TANITASIORA]([C_DATUM] ASC, [C_HELYETTESITOTANARID] ASC, [C_OSZTALYCSOPORTID] ASC, [C_TANEVID] ASC, [C_INTEZMENYID] ASC) WHERE ([TOROLT]='F');


GO
PRINT N'Creating [dbo].[T_TANITASIORA].[IX_TANITASIORA_DATUM_CSENGETESIRENDID_INTEZMENYID_TANEVID]...';


GO
CREATE NONCLUSTERED INDEX [IX_TANITASIORA_DATUM_CSENGETESIRENDID_INTEZMENYID_TANEVID]
    ON [dbo].[T_TANITASIORA]([C_DATUM] ASC, [C_CSENGETESIRENDID] ASC, [C_INTEZMENYID] ASC, [C_TANEVID] ASC) WHERE ([TOROLT]='F');


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


GO
BEGIN TRANSACTION;

SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;

SET XACT_ABORT ON;

CREATE TABLE [dbo].[tmp_ms_xx_T_TANULOERTEKELES] (
    [ID]                            INT            IDENTITY (1, 1) NOT NULL,
    [C_DATUM]                       DATETIME       NOT NULL,
    [C_TIPUSID]                     INT            NOT NULL,
    [C_ERTEKELESSZOVEG]             NVARCHAR (MAX) NULL,
    [C_ROGZITESDATUM]               DATETIME       NOT NULL,
    [C_ERTEKELESOSZTALYZATID]       INT            NULL,
    [C_ERTEKELESSZOVEGROVIDNEV]     NVARCHAR (3)   NULL,
    [C_ERTEKELESMODID]              INT            NULL,
    [C_ERTEKELESTEMA]               NVARCHAR (255) NULL,
    [C_ERTEKELESSZAZALEK]           INT            NULL,
    [C_ISMAGATARTASSZORGALOM]       CHAR (1)       NOT NULL,
    [C_MAGATARTASERTEKID]           INT            NULL,
    [C_MAGATARTASOSZTALYZATID]      INT            NULL,
    [C_MAGATARTASSZOVEG]            NVARCHAR (MAX) NULL,
    [C_MAGATARTASSZOVEGROVIDNEV]    NVARCHAR (3)   NULL,
    [C_SZORGALOMERTEKID]            INT            NULL,
    [C_SZORGALOMOSZTALYZATID]       INT            NULL,
    [C_SZORGALOMSZOVEG]             NVARCHAR (MAX) NULL,
    [C_SZORGALOMSZOVEGROVIDNEV]     NVARCHAR (3)   NULL,
    [C_ISFROMMOBIL]                 CHAR (1)       DEFAULT ('F') NOT NULL,
    [C_TANTARGYID]                  INT            NULL,
    [C_TANULOID]                    INT            NOT NULL,
    [C_OSZTALYCSOPORTID]            INT            NULL,
    [C_ERTEKELOID]                  INT            NOT NULL,
    [C_TANORAID]                    INT            NULL,
    [C_OSSZEFUGGOSZAKGYAKID]        INT            NULL,
    [C_ROGZITESKORITANULOOSZTALYID] INT            NULL,
    [C_INTEZMENYID]                 INT            NOT NULL,
    [C_TANEVID]                     INT            NOT NULL,
    [TOROLT]                        CHAR (1)       DEFAULT ('F') NOT NULL,
    [SERIAL]                        INT            DEFAULT ((0)) NOT NULL,
    [LASTCHANGED]                   DATETIME       DEFAULT (getdate()) NOT NULL,
    [CREATED]                       DATETIME       DEFAULT (getdate()) NOT NULL,
    [MODIFIER]                      INT            NULL,
    [CREATOR]                       INT            NULL,
    [ELOZOTANEVIREKORDID]           INT            NULL,
    [NNID]                          INT            NULL,
    CONSTRAINT [tmp_ms_xx_constraint_PK_T_40256411] PRIMARY KEY CLUSTERED ([ID] ASC)
);

IF EXISTS (SELECT TOP 1 1 
           FROM   [dbo].[T_TANULOERTEKELES])
    BEGIN
        SET IDENTITY_INSERT [dbo].[tmp_ms_xx_T_TANULOERTEKELES] ON;
        INSERT INTO [dbo].[tmp_ms_xx_T_TANULOERTEKELES] ([ID], [C_DATUM], [C_TIPUSID], [C_ERTEKELESSZOVEG], [C_ROGZITESDATUM], [C_ERTEKELESOSZTALYZATID], [C_ERTEKELESSZOVEGROVIDNEV], [C_ERTEKELESMODID], [C_ERTEKELESTEMA], [C_ERTEKELESSZAZALEK], [C_ISMAGATARTASSZORGALOM], [C_MAGATARTASERTEKID], [C_MAGATARTASOSZTALYZATID], [C_MAGATARTASSZOVEG], [C_MAGATARTASSZOVEGROVIDNEV], [C_SZORGALOMERTEKID], [C_SZORGALOMOSZTALYZATID], [C_SZORGALOMSZOVEG], [C_SZORGALOMSZOVEGROVIDNEV], [C_TANTARGYID], [C_TANULOID], [C_OSZTALYCSOPORTID], [C_ERTEKELOID], [C_TANORAID], [C_OSSZEFUGGOSZAKGYAKID], [C_ROGZITESKORITANULOOSZTALYID], [C_INTEZMENYID], [C_TANEVID], [TOROLT], [SERIAL], [LASTCHANGED], [CREATED], [MODIFIER], [CREATOR], [ELOZOTANEVIREKORDID], [NNID])
        SELECT   [ID],
                 [C_DATUM],
                 [C_TIPUSID],
                 [C_ERTEKELESSZOVEG],
                 [C_ROGZITESDATUM],
                 [C_ERTEKELESOSZTALYZATID],
                 [C_ERTEKELESSZOVEGROVIDNEV],
                 [C_ERTEKELESMODID],
                 [C_ERTEKELESTEMA],
                 [C_ERTEKELESSZAZALEK],
                 [C_ISMAGATARTASSZORGALOM],
                 [C_MAGATARTASERTEKID],
                 [C_MAGATARTASOSZTALYZATID],
                 [C_MAGATARTASSZOVEG],
                 [C_MAGATARTASSZOVEGROVIDNEV],
                 [C_SZORGALOMERTEKID],
                 [C_SZORGALOMOSZTALYZATID],
                 [C_SZORGALOMSZOVEG],
                 [C_SZORGALOMSZOVEGROVIDNEV],
                 [C_TANTARGYID],
                 [C_TANULOID],
                 [C_OSZTALYCSOPORTID],
                 [C_ERTEKELOID],
                 [C_TANORAID],
                 [C_OSSZEFUGGOSZAKGYAKID],
                 [C_ROGZITESKORITANULOOSZTALYID],
                 [C_INTEZMENYID],
                 [C_TANEVID],
                 [TOROLT],
                 [SERIAL],
                 [LASTCHANGED],
                 [CREATED],
                 [MODIFIER],
                 [CREATOR],
                 [ELOZOTANEVIREKORDID],
                 [NNID]
        FROM     [dbo].[T_TANULOERTEKELES]
        ORDER BY [ID] ASC;
        SET IDENTITY_INSERT [dbo].[tmp_ms_xx_T_TANULOERTEKELES] OFF;
    END

DROP TABLE [dbo].[T_TANULOERTEKELES];

EXECUTE sp_rename N'[dbo].[tmp_ms_xx_T_TANULOERTEKELES]', N'T_TANULOERTEKELES';

EXECUTE sp_rename N'[dbo].[tmp_ms_xx_constraint_PK_T_40256411]', N'PK_T_4025641', N'OBJECT';

COMMIT TRANSACTION;

SET TRANSACTION ISOLATION LEVEL READ COMMITTED;


GO
PRINT N'Creating [dbo].[T_TANULOERTEKELES].[I_T_4025641_4025644]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025641_4025644]
    ON [dbo].[T_TANULOERTEKELES]([C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_TIPUSID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOERTEKELES].[I_T_4025641_4026317]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025641_4026317]
    ON [dbo].[T_TANULOERTEKELES]([C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_ERTEKELESOSZTALYZATID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOERTEKELES].[I_T_4025641_4028206]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025641_4028206]
    ON [dbo].[T_TANULOERTEKELES]([C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_ERTEKELESMODID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOERTEKELES].[I_T_4025641_4028210]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025641_4028210]
    ON [dbo].[T_TANULOERTEKELES]([C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_MAGATARTASERTEKID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOERTEKELES].[I_T_4025641_4028211]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025641_4028211]
    ON [dbo].[T_TANULOERTEKELES]([C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_MAGATARTASOSZTALYZATID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOERTEKELES].[I_T_4025641_4028214]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025641_4028214]
    ON [dbo].[T_TANULOERTEKELES]([C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_SZORGALOMERTEKID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOERTEKELES].[I_T_4025641_4028215]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025641_4028215]
    ON [dbo].[T_TANULOERTEKELES]([C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_SZORGALOMOSZTALYZATID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOERTEKELES].[I_T_4025662_4025660]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025662_4025660]
    ON [dbo].[T_TANULOERTEKELES]([C_TANTARGYID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOERTEKELES].[I_T_4025665_4025663]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025665_4025663]
    ON [dbo].[T_TANULOERTEKELES]([C_TANULOID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOERTEKELES].[I_T_4025668_4025666]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025668_4025666]
    ON [dbo].[T_TANULOERTEKELES]([C_OSZTALYCSOPORTID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOERTEKELES].[I_T_4025670_4025669]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025670_4025669]
    ON [dbo].[T_TANULOERTEKELES]([C_ERTEKELOID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOERTEKELES].[I_T_4025938_4025937]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025938_4025937]
    ON [dbo].[T_TANULOERTEKELES]([C_TANORAID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOERTEKELES].[I_T_4028380_4028379]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4028380_4028379]
    ON [dbo].[T_TANULOERTEKELES]([C_OSSZEFUGGOSZAKGYAKID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOERTEKELES].[I_T_4028462_4028461]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4028462_4028461]
    ON [dbo].[T_TANULOERTEKELES]([C_ROGZITESKORITANULOOSZTALYID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOERTEKELES].[I_T_402564102_402564100]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402564102_402564100]
    ON [dbo].[T_TANULOERTEKELES]([C_INTEZMENYID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOERTEKELES].[I_T_402564105_402564103]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402564105_402564103]
    ON [dbo].[T_TANULOERTEKELES]([C_TANEVID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOERTEKELES].[IDX_TANULOERTEKELES_TANULOID_TANTARGYID_ERTEKELESTIPUSA]...';


GO
CREATE NONCLUSTERED INDEX [IDX_TANULOERTEKELES_TANULOID_TANTARGYID_ERTEKELESTIPUSA]
    ON [dbo].[T_TANULOERTEKELES]([C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_TANULOID] ASC, [C_TANTARGYID] ASC, [C_TIPUSID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOERTEKELES].[IX_TANULOERTEKELES_TANULOID_TIPUSID_INTEZMENYID_TANEVID_ERTEKELESOSZTALYZATID]...';


GO
CREATE NONCLUSTERED INDEX [IX_TANULOERTEKELES_TANULOID_TIPUSID_INTEZMENYID_TANEVID_ERTEKELESOSZTALYZATID]
    ON [dbo].[T_TANULOERTEKELES]([C_TANULOID] ASC, [C_TIPUSID] ASC, [C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_ERTEKELESOSZTALYZATID] ASC)
    INCLUDE([C_ERTEKELESMODID], [C_ROGZITESKORITANULOOSZTALYID], [C_TANTARGYID]) WHERE ([TOROLT]='F');


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_4028143_4028141]...';


GO
ALTER TABLE [dbo].[T_ORARENDIORATULAJDONSAG] WITH NOCHECK
    ADD CONSTRAINT [FK_4028143_4028141] FOREIGN KEY ([C_ORARENDIORAID]) REFERENCES [dbo].[T_ORARENDIORA] ([ID]);


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


GO
ALTER TABLE [dbo].[T_TANITASIORA] WITH NOCHECK
    ADD CONSTRAINT [FK_4025620_4025619] FOREIGN KEY ([C_ORARENDIORAID]) REFERENCES [dbo].[T_ORARENDIORA] ([ID]);


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


GO
ALTER TABLE [dbo].[T_HELYETTESITESIIDOSZAK] WITH NOCHECK
    ADD CONSTRAINT [FK_4026290_4026289] FOREIGN KEY ([C_HELYETTESITETTORARENDID]) REFERENCES [dbo].[T_ORARENDIORA] ([ID]);


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


GO
ALTER TABLE [dbo].[T_HAZIFELADATOK] WITH NOCHECK
    ADD CONSTRAINT [FK_4028285_4028284] FOREIGN KEY ([C_ORARENDIORAID]) REFERENCES [dbo].[T_ORARENDIORA] ([ID]);


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


GO
ALTER TABLE [dbo].[T_ORARENDIORA] WITH NOCHECK
    ADD CONSTRAINT [FK_4025550_4025549] FOREIGN KEY ([C_TEREMID]) REFERENCES [dbo].[T_TEREM] ([ID]);


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


--GO
--ALTER TABLE [dbo].[T_ORARENDIORA] WITH NOCHECK
--    ADD CONSTRAINT [FK_4025554_4025552] FOREIGN KEY ([C_FOGLALKOZASID]) REFERENCES [dbo].[T_FOGLALKOZAS] ([ID]);


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


GO
ALTER TABLE [dbo].[T_ORARENDIORA] WITH NOCHECK
    ADD CONSTRAINT [FK_4026321_4026319] FOREIGN KEY ([C_TANTARGYID]) REFERENCES [dbo].[T_TANTARGY] ([ID]);


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


GO
ALTER TABLE [dbo].[T_ORARENDIORA] WITH NOCHECK
    ADD CONSTRAINT [FK_4026324_4026322] FOREIGN KEY ([C_OSZTALYCSOPORTID]) REFERENCES [dbo].[T_OSZTALYCSOPORT] ([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_4026329_4026328]...';


GO
ALTER TABLE [dbo].[T_ORARENDIORA] WITH NOCHECK
    ADD CONSTRAINT [FK_4026329_4026328] FOREIGN KEY ([C_ORATULAJDONOSID]) REFERENCES [dbo].[T_FELHASZNALO] ([ID]);


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_ORARENDIORA] WITH NOCHECK
    ADD CONSTRAINT [FK_4025530_4025533] FOREIGN KEY ([C_HETIREND], [C_INTEZMENYID], [C_TANEVID]) REFERENCES [dbo].[T_HETIRENDTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


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


GO
ALTER TABLE [dbo].[T_ORARENDIORA] WITH NOCHECK
    ADD CONSTRAINT [FK_4025530_4025534] FOREIGN KEY ([C_HETNAPJA], [C_INTEZMENYID], [C_TANEVID]) REFERENCES [dbo].[T_HETNAPJATIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


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


GO
ALTER TABLE [dbo].[T_NAPLOELLENORZES] WITH NOCHECK
    ADD CONSTRAINT [FK_4025763_4025762] FOREIGN KEY ([C_OSZTALYID]) REFERENCES [dbo].[T_OSZTALY] ([ID]);


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


GO
ALTER TABLE [dbo].[T_OSZTALY] WITH NOCHECK
    ADD CONSTRAINT [FK_T_4025296_4025338] FOREIGN KEY ([ID]) REFERENCES [dbo].[T_OSZTALYCSOPORT] ([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_4025421_4025419]...';


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


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_OSZTALY] WITH NOCHECK
    ADD CONSTRAINT [FK_4025294_4025295] FOREIGN KEY ([C_KEPZESIFORMA], [C_ALINTEZMENYID], [C_ALTANEVID]) REFERENCES [dbo].[T_TANTERVIJELLEG] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


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


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


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


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


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_OSZTALY] WITH NOCHECK
    ADD CONSTRAINT [FK_4025294_4028299] FOREIGN KEY ([C_GIMNAZIUMIEVFOLYAMTIPUSID], [C_ALINTEZMENYID], [C_ALTANEVID]) REFERENCES [dbo].[T_GIMNAZIUMIEVFOLYAMTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


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


GO
ALTER TABLE [dbo].[T_CSOPORT] WITH NOCHECK
    ADD CONSTRAINT [FK_4026206_4026204] FOREIGN KEY ([C_OSZTALYBONTASID]) REFERENCES [dbo].[T_OSZTALY] ([ID]);


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


GO
ALTER TABLE [dbo].[T_CSOPORTOK_OSZTALYOK] WITH NOCHECK
    ADD CONSTRAINT [FK_4025318_4025316] FOREIGN KEY ([C_OSZTALYOKID]) REFERENCES [dbo].[T_OSZTALY] ([ID]);


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


GO
ALTER TABLE [dbo].[T_ORALATOGATAS] WITH NOCHECK
    ADD CONSTRAINT [FK_4025795_4025794] FOREIGN KEY ([C_MEGTARTOTTORAID]) REFERENCES [dbo].[T_TANITASIORA] ([ID]);


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


GO
ALTER TABLE [dbo].[T_TANITASIORATULAJDONSAG] WITH NOCHECK
    ADD CONSTRAINT [FK_4028146_4028144] FOREIGN KEY ([C_TANITASIORAID]) REFERENCES [dbo].[T_TANITASIORA] ([ID]);


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


GO
ALTER TABLE [dbo].[T_TANULOESEMENY] WITH NOCHECK
    ADD CONSTRAINT [FK_4027536_4027535] FOREIGN KEY ([C_TANITASIORAID]) REFERENCES [dbo].[T_TANITASIORA] ([ID]);


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


GO
ALTER TABLE [dbo].[T_TANULOMULASZTAS] WITH NOCHECK
    ADD CONSTRAINT [FK_4025674_4025672] FOREIGN KEY ([C_TANITASIORAKID]) REFERENCES [dbo].[T_TANITASIORA] ([ID]);


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


GO
ALTER TABLE [dbo].[T_TANULOERTEKELES] WITH NOCHECK
    ADD CONSTRAINT [FK_4025938_4025937] FOREIGN KEY ([C_TANORAID]) REFERENCES [dbo].[T_TANITASIORA] ([ID]);


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


GO
ALTER TABLE [dbo].[T_TANITASIORA] WITH NOCHECK
    ADD CONSTRAINT [FK_4025602_4025601] FOREIGN KEY ([C_TANMENETID]) REFERENCES [dbo].[T_TANMENET] ([ID]);


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


GO
ALTER TABLE [dbo].[T_TANITASIORA] WITH NOCHECK
    ADD CONSTRAINT [FK_4025608_4025607] FOREIGN KEY ([C_TANTARGYID]) REFERENCES [dbo].[T_TANTARGY] ([ID]);


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


--GO
--ALTER TABLE [dbo].[T_TANITASIORA] WITH NOCHECK
--    ADD CONSTRAINT [FK_4025623_4025622] FOREIGN KEY ([C_FOGLALKOZASID]) REFERENCES [dbo].[T_FOGLALKOZAS] ([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_4025633_4025631]...';


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


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


GO
ALTER TABLE [dbo].[T_TANITASIORA] WITH NOCHECK
    ADD CONSTRAINT [FK_4025635_4025634] FOREIGN KEY ([C_TEREMID]) REFERENCES [dbo].[T_TEREM] ([ID]);


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


GO
ALTER TABLE [dbo].[T_TANITASIORA] WITH NOCHECK
    ADD CONSTRAINT [FK_4025638_4025637] FOREIGN KEY ([C_OSZTALYCSOPORTID]) REFERENCES [dbo].[T_OSZTALYCSOPORT] ([ID]);


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


GO
ALTER TABLE [dbo].[T_TANITASIORA] WITH NOCHECK
    ADD CONSTRAINT [FK_4026315_4026314] FOREIGN KEY ([C_ORATULAJDONOSID]) REFERENCES [dbo].[T_FELHASZNALO] ([ID]);


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


GO
ALTER TABLE [dbo].[T_TANITASIORA] WITH NOCHECK
    ADD CONSTRAINT [FK_4027901_4027900] FOREIGN KEY ([C_UPLOADEDFILEID]) REFERENCES [dbo].[T_UPLOADEDFILE] ([ID]);


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_TANITASIORA] WITH NOCHECK
    ADD CONSTRAINT [FK_4025611_4025610] FOREIGN KEY ([C_NAPTARINAPID]) REFERENCES [dbo].[T_NAPTARINAP] ([ID]);


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


GO
ALTER TABLE [dbo].[T_TANITASIORA] WITH NOCHECK
    ADD CONSTRAINT [FK_4025575_4025580] FOREIGN KEY ([C_HELYETTESITESTIPUSA], [C_INTEZMENYID], [C_TANEVID]) REFERENCES [dbo].[T_HELYETTESITESTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


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


GO
ALTER TABLE [dbo].[T_TANITASIORA] WITH NOCHECK
    ADD CONSTRAINT [FK_4025575_4025581] FOREIGN KEY ([C_HETNAPJA], [C_INTEZMENYID], [C_TANEVID]) REFERENCES [dbo].[T_HETNAPJATIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


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


GO
ALTER TABLE [dbo].[T_HAZIFELADATOK] WITH NOCHECK
    ADD CONSTRAINT [FK_4028129_4028127] FOREIGN KEY ([C_TANITASIORAID]) REFERENCES [dbo].[T_TANITASIORA] ([ID]);


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


GO
ALTER TABLE [dbo].[T_TANULOERTEKELES] WITH NOCHECK
    ADD CONSTRAINT [FK_4028462_4028461] FOREIGN KEY ([C_ROGZITESKORITANULOOSZTALYID]) REFERENCES [dbo].[T_OSZTALYCSOPORT] ([ID]);


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_TANULOERTEKELES] WITH NOCHECK
    ADD CONSTRAINT [FK_4025641_4025644] FOREIGN KEY ([C_TIPUSID], [C_INTEZMENYID], [C_TANEVID]) REFERENCES [dbo].[T_ERTEKELESTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


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


GO
ALTER TABLE [dbo].[T_TANULOERTEKELES] WITH NOCHECK
    ADD CONSTRAINT [FK_4025641_4026317] FOREIGN KEY ([C_ERTEKELESOSZTALYZATID], [C_INTEZMENYID], [C_TANEVID]) REFERENCES [dbo].[T_OSZTALYZATTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


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


GO
ALTER TABLE [dbo].[T_TANULOERTEKELES] WITH NOCHECK
    ADD CONSTRAINT [FK_4025641_4028206] FOREIGN KEY ([C_ERTEKELESMODID], [C_INTEZMENYID], [C_TANEVID]) REFERENCES [dbo].[T_ERTEKELESMOD] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


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


GO
ALTER TABLE [dbo].[T_TANULOERTEKELES] WITH NOCHECK
    ADD CONSTRAINT [FK_4025641_4028210] FOREIGN KEY ([C_MAGATARTASERTEKID], [C_INTEZMENYID], [C_TANEVID]) REFERENCES [dbo].[T_MAGATARTASERTEKELESTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


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


GO
ALTER TABLE [dbo].[T_TANULOERTEKELES] WITH NOCHECK
    ADD CONSTRAINT [FK_4025641_4028211] FOREIGN KEY ([C_MAGATARTASOSZTALYZATID], [C_INTEZMENYID], [C_TANEVID]) REFERENCES [dbo].[T_OSZTALYZATTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


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


GO
ALTER TABLE [dbo].[T_TANULOERTEKELES] WITH NOCHECK
    ADD CONSTRAINT [FK_4025641_4028214] FOREIGN KEY ([C_SZORGALOMERTEKID], [C_INTEZMENYID], [C_TANEVID]) REFERENCES [dbo].[T_SZORGALOMERTEKELESTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


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


GO
ALTER TABLE [dbo].[T_TANULOERTEKELES] WITH NOCHECK
    ADD CONSTRAINT [FK_4025641_4028215] FOREIGN KEY ([C_SZORGALOMOSZTALYZATID], [C_INTEZMENYID], [C_TANEVID]) REFERENCES [dbo].[T_OSZTALYZATTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


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


GO
ALTER TABLE [dbo].[T_TANULOERTEKELES] WITH NOCHECK
    ADD CONSTRAINT [FK_4025662_4025660] FOREIGN KEY ([C_TANTARGYID]) REFERENCES [dbo].[T_TANTARGY] ([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_4025668_4025666]...';


GO
ALTER TABLE [dbo].[T_TANULOERTEKELES] WITH NOCHECK
    ADD CONSTRAINT [FK_4025668_4025666] FOREIGN KEY ([C_OSZTALYCSOPORTID]) REFERENCES [dbo].[T_OSZTALYCSOPORT] ([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_4028380_4028379]...';


GO
ALTER TABLE [dbo].[T_TANULOERTEKELES] WITH NOCHECK
    ADD CONSTRAINT [FK_4028380_4028379] FOREIGN KEY ([C_OSSZEFUGGOSZAKGYAKID]) REFERENCES [dbo].[T_OSSZEFUGGOSZAKGYAK] ([ID]);


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


GO
ALTER TABLE [dbo].[T_TANULOERTEKELESLATTAMOZAS] WITH NOCHECK
    ADD CONSTRAINT [FK_4028054_4028052] FOREIGN KEY ([C_TANULOERTEKELESID]) REFERENCES [dbo].[T_TANULOERTEKELES] ([ID]);

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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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'Refreshing [dbo].[sp_Global_GetDatabaseErrors]...';


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


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


GO
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_ORARENDIORATULAJDONSAG] WITH CHECK CHECK CONSTRAINT [FK_4028143_4028141];

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

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

ALTER TABLE [dbo].[T_HAZIFELADATOK] WITH CHECK CHECK CONSTRAINT [FK_4028285_4028284];

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

--ALTER TABLE [dbo].[T_ORARENDIORA] WITH CHECK CHECK CONSTRAINT [FK_4025554_4025552];

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

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

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

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

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

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

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

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

ALTER TABLE [dbo].[T_NAPLOELLENORZES] WITH CHECK CHECK CONSTRAINT [FK_4025763_4025762];

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

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_OSZTALY] WITH CHECK CHECK CONSTRAINT [FK_4025421_4025419];

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

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

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

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

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

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

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

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

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

ALTER TABLE [dbo].[T_CSOPORTOK_OSZTALYOK] WITH CHECK CHECK CONSTRAINT [FK_4025318_4025316];

ALTER TABLE [dbo].[T_ORALATOGATAS] WITH CHECK CHECK CONSTRAINT [FK_4025795_4025794];

ALTER TABLE [dbo].[T_TANITASIORATULAJDONSAG] WITH CHECK CHECK CONSTRAINT [FK_4028146_4028144];

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

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

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

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

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

--ALTER TABLE [dbo].[T_TANITASIORA] WITH CHECK CHECK CONSTRAINT [FK_4025623_4025622];

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

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

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

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

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

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

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

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

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

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

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

ALTER TABLE [dbo].[T_HAZIFELADATOK] WITH CHECK CHECK CONSTRAINT [FK_4028129_4028127];

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

ALTER TABLE [dbo].[T_TANULOERTEKELESLATTAMOZAS] WITH CHECK CHECK CONSTRAINT [FK_4028054_4028052];


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_TANITASIORA', 'T_TANITASIORA_OSSZES',
					 'T_TANULOERTEKELES', 'T_TANULOERTEKELES_OSSZES',
					 'T_ORARENDIORA', 'T_ORARENDIORA_OSSZES',
					 'T_OSZTALY', 'T_OSZTALY_OSSZES',
					 'T_INTEZMENYADATSZOLGALTATAS', 'T_INTEZMENYADATSZOLGALTATAS_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


--------------------


EXEC dev.sp_Global_GenerateAsyncAuditTriggerAll
GO

EXEC dev.sp_Global_GenerateAsyncAuditProcedureAll
GO

EXEC dev.sp_Global_GenerateAsyncAuditAuditPocessing
GO

ALTER QUEUE auditLog.[AuditQueue]
WITH ACTIVATION
( 
    STATUS = ON,
    PROCEDURE_NAME = auditLog.usp_AuditProcessing,
    MAX_QUEUE_READERS = 10,
    EXECUTE AS 'Kreta_tech_user'
);

GO