﻿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].[T_IKTATOTTDOKUMENTUM].[I_T_4028572_4028570]...';


GO
DROP INDEX [I_T_4028572_4028570]
    ON [dbo].[T_IKTATOTTDOKUMENTUM];


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


GO
ALTER TABLE [dbo].[T_IKTATOTTDOKUMENTUM] DROP CONSTRAINT [FK_4028569_4028567];


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


GO
ALTER TABLE [dbo].[T_IKTATOTTDOKUMENTUM] DROP CONSTRAINT [FK_4028572_4028570];


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


GO
ALTER TABLE [dbo].[T_IKTATOTTDOKUMENTUM] DROP CONSTRAINT [FK_402854402_402854400];


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


GO
ALTER TABLE [dbo].[T_IKTATOTTDOKUMENTUM] DROP CONSTRAINT [FK_402854405_402854403];


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


GO
ALTER TABLE [dbo].[T_IKTATOTTDOKUMENTUM] DROP CONSTRAINT [FK_4028544_4028554];


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


GO
ALTER TABLE [dbo].[T_IKTATOTTDOKUMENTUM] DROP CONSTRAINT [FK_4028544_4028555];


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


GO
ALTER TABLE [dbo].[T_IKTATOTTDOKUMENTUM] DROP CONSTRAINT [FK_4028544_4028556];


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


GO
ALTER TABLE [dbo].[T_DOKUMENTUMKULCSSZO] DROP CONSTRAINT [FK_4028563_4028561];


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_OSZTALYCSOPORT_TANEVRENDJE] DROP CONSTRAINT [FK_4025515_4025513];


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


GO
ALTER TABLE [dbo].[T_TANEVRENDJE] DROP CONSTRAINT [FK_4026086_4026085];


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


GO
ALTER TABLE [dbo].[T_TANEVRENDJE] DROP CONSTRAINT [FK_402544102_402544100];


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


GO
ALTER TABLE [dbo].[T_TANEVRENDJE] DROP CONSTRAINT [FK_402544105_402544103];


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


GO
ALTER TABLE [dbo].[T_TANEVRENDJE] DROP CONSTRAINT [FK_4025441_4025444];


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


GO
ALTER TABLE [dbo].[T_TANEVRENDJE] DROP CONSTRAINT [FK_4025441_4025445];


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


GO
ALTER TABLE [dbo].[T_TANEVRENDJE] DROP CONSTRAINT [FK_4025441_4025447];


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


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


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'Starting rebuilding table [dbo].[T_IKTATOTTDOKUMENTUM]...';


GO
BEGIN TRANSACTION;

SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;

SET XACT_ABORT ON;

CREATE TABLE [dbo].[tmp_ms_xx_T_IKTATOTTDOKUMENTUM] (
    [ID]                             INT            IDENTITY (1, 1) NOT NULL,
    [C_DOKUMENTUMNEVE]               NVARCHAR (512) NOT NULL,
    [C_IKTATOSZAM]                   NVARCHAR (128) NULL,
    [C_GENERALASDATUMA]              DATETIME       NOT NULL,
    [C_IKTATASDATUMA]                DATETIME       NULL,
    [C_ELEKTRONIKUSPELDANYFELTOLTES] DATETIME       NULL,
    [C_ELEKTRONIKUSPELDANYID]        NVARCHAR (8)   NULL,
    [C_GENERALTDOKUMENTUMID]         INT            NULL,
    [C_VONALKOD]                     NVARCHAR (64)  NOT NULL,
    [C_MAPPA]                        NVARCHAR (256) NOT NULL,
    [C_DOKUMENTUMKATEGORIA]          INT            NOT NULL,
    [C_DOKUMENTUMTIPUS]              INT            NOT NULL,
    [C_DOKUMENTUMSTATUSZ]            INT            NOT NULL,
    [C_FELADATELLATASIHELYID]        INT            NULL,
    [C_IKTATOSZEMELYID]              INT            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_40285441] PRIMARY KEY CLUSTERED ([ID] ASC)
);

IF EXISTS (SELECT TOP 1 1 
           FROM   [dbo].[T_IKTATOTTDOKUMENTUM])
    BEGIN
        SET IDENTITY_INSERT [dbo].[tmp_ms_xx_T_IKTATOTTDOKUMENTUM] ON;
        INSERT INTO [dbo].[tmp_ms_xx_T_IKTATOTTDOKUMENTUM] ([ID], [C_DOKUMENTUMNEVE], [C_IKTATOSZAM], [C_GENERALASDATUMA], [C_IKTATASDATUMA], [C_ELEKTRONIKUSPELDANYFELTOLTES], [C_ELEKTRONIKUSPELDANYID], [C_GENERALTDOKUMENTUMID], [C_VONALKOD], [C_MAPPA], [C_DOKUMENTUMKATEGORIA], [C_DOKUMENTUMTIPUS], [C_DOKUMENTUMSTATUSZ], [C_FELADATELLATASIHELYID], [C_INTEZMENYID], [C_TANEVID], [TOROLT], [SERIAL], [LASTCHANGED], [CREATED], [MODIFIER], [CREATOR], [ELOZOTANEVIREKORDID], [NNID])
        SELECT   [ID],
                 [C_DOKUMENTUMNEVE],
                 [C_IKTATOSZAM],
                 [C_GENERALASDATUMA],
                 [C_IKTATASDATUMA],
                 [C_ELEKTRONIKUSPELDANYFELTOLTES],
                 [C_ELEKTRONIKUSPELDANYID],
                 [C_GENERALTDOKUMENTUMID],
                 [C_VONALKOD],
                 [C_MAPPA],
                 [C_DOKUMENTUMKATEGORIA],
                 [C_DOKUMENTUMTIPUS],
                 [C_DOKUMENTUMSTATUSZ],
                 [C_FELADATELLATASIHELYID],
                 [C_INTEZMENYID],
                 [C_TANEVID],
                 [TOROLT],
                 [SERIAL],
                 [LASTCHANGED],
                 [CREATED],
                 [MODIFIER],
                 [CREATOR],
                 [ELOZOTANEVIREKORDID],
                 [NNID]
        FROM     [dbo].[T_IKTATOTTDOKUMENTUM]
        ORDER BY [ID] ASC;
        SET IDENTITY_INSERT [dbo].[tmp_ms_xx_T_IKTATOTTDOKUMENTUM] OFF;
    END

DROP TABLE [dbo].[T_IKTATOTTDOKUMENTUM];

EXECUTE sp_rename N'[dbo].[tmp_ms_xx_T_IKTATOTTDOKUMENTUM]', N'T_IKTATOTTDOKUMENTUM';

EXECUTE sp_rename N'[dbo].[tmp_ms_xx_constraint_PK_T_40285441]', N'PK_T_4028544', N'OBJECT';

COMMIT TRANSACTION;

SET TRANSACTION ISOLATION LEVEL READ COMMITTED;


GO
PRINT N'Creating [dbo].[T_IKTATOTTDOKUMENTUM].[I_T_4028544_4028554]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4028544_4028554]
    ON [dbo].[T_IKTATOTTDOKUMENTUM]([C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_DOKUMENTUMKATEGORIA] ASC);


GO
PRINT N'Creating [dbo].[T_IKTATOTTDOKUMENTUM].[I_T_4028544_4028555]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4028544_4028555]
    ON [dbo].[T_IKTATOTTDOKUMENTUM]([C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_DOKUMENTUMTIPUS] ASC);


GO
PRINT N'Creating [dbo].[T_IKTATOTTDOKUMENTUM].[I_T_4028544_4028556]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4028544_4028556]
    ON [dbo].[T_IKTATOTTDOKUMENTUM]([C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_DOKUMENTUMSTATUSZ] ASC);


GO
PRINT N'Creating [dbo].[T_IKTATOTTDOKUMENTUM].[I_T_4028569_4028567]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4028569_4028567]
    ON [dbo].[T_IKTATOTTDOKUMENTUM]([C_FELADATELLATASIHELYID] ASC);


GO
PRINT N'Creating [dbo].[T_IKTATOTTDOKUMENTUM].[I_T_4028589_4028587]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4028589_4028587]
    ON [dbo].[T_IKTATOTTDOKUMENTUM]([C_IKTATOSZEMELYID] ASC);


GO
PRINT N'Creating [dbo].[T_IKTATOTTDOKUMENTUM].[I_T_402854402_402854400]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402854402_402854400]
    ON [dbo].[T_IKTATOTTDOKUMENTUM]([C_INTEZMENYID] ASC);


GO
PRINT N'Creating [dbo].[T_IKTATOTTDOKUMENTUM].[I_T_402854405_402854403]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402854405_402854403]
    ON [dbo].[T_IKTATOTTDOKUMENTUM]([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_KOMPLEXORA]               CHAR (1) DEFAULT ('F') NOT NULL,
    [C_KIPORA]                   CHAR (1) DEFAULT ('F') NOT NULL,
    [C_VEKOP73317]               CHAR (1) DEFAULT ('F') NOT NULL,
    [C_KAPORA]                   CHAR (1) DEFAULT ('F') NOT NULL,
    [C_GINOP623]                 CHAR (1) DEFAULT ('F') NOT NULL,
    [C_EGYEDINAP]                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_EFOP32317], [C_MULTIKULTURALISORA], [C_KOMPLEXORA], [C_KIPORA], [C_VEKOP73317], [C_KAPORA], [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_EFOP32317],
                 [C_MULTIKULTURALISORA],
                 [C_KOMPLEXORA],
                 [C_KIPORA],
                 [C_VEKOP73317],
                 [C_KAPORA],
                 [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].[NCI_OrarendiOra_OrarendiOraGroupId_OraErvenyessegKezdete_TanevId_IntezmenyId]...';


GO
CREATE NONCLUSTERED INDEX [NCI_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') WITH (FILLFACTOR = 80);


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


GO
CREATE NONCLUSTERED INDEX [NCI_OrarendiOra_OsztalyCsoportId_IntezmenyId_TanevId_HETNAPJA_OraErvenyessegKezdete_OraErvenyessegVege_HETIREND]
    ON [dbo].[T_ORARENDIORA]([C_OSZTALYCSOPORTID] ASC, [C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_HETNAPJA] ASC, [C_ORAERVENYESSEGKEZDETE] ASC, [C_ORAERVENYESSEGVEGE] ASC, [C_HETIREND] ASC)
    INCLUDE([C_CSENGETESIRENDID]) WHERE ([TOROLT]='F') WITH (FILLFACTOR = 80);


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


GO
CREATE NONCLUSTERED INDEX [NCI_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].[NCI_OrarendiOra_TanarId_OraErvenyessegKezdete_OraErvenyessegVege_IntezmenyId_TanevId]...';


GO
CREATE NONCLUSTERED INDEX [NCI_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') WITH (FILLFACTOR = 80);


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


GO
CREATE NONCLUSTERED INDEX [NCI_OrarendiOra_TeremId_IntezmenyId_OraErvenyessegKezdete_OraErvenyessegVege_TanevId]
    ON [dbo].[T_ORARENDIORA]([C_TEREMID] ASC, [C_INTEZMENYID] ASC, [C_ORAERVENYESSEGKEZDETE] ASC, [C_ORAERVENYESSEGVEGE] ASC, [C_TANEVID] ASC) WHERE ([TOROLT]='F') WITH (FILLFACTOR = 80);


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


GO
CREATE NONCLUSTERED INDEX [NCI_OrarendiOra_TantargyId_IntezmenyId_OraErvenyessegKezdete_OraErvenyessegVege_TanevId]
    ON [dbo].[T_ORARENDIORA]([C_TANTARGYID] ASC, [C_INTEZMENYID] ASC, [C_ORAERVENYESSEGKEZDETE] ASC, [C_ORAERVENYESSEGVEGE] ASC, [C_TANEVID] ASC) WHERE ([TOROLT]='F') WITH (FILLFACTOR = 80);


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


GO
BEGIN TRANSACTION;

SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;

SET XACT_ABORT ON;

CREATE TABLE [dbo].[tmp_ms_xx_T_TANEVRENDJE] (
    [ID]                          INT            IDENTITY (1, 1) NOT NULL,
    [C_AKTIV]                     CHAR (1)       DEFAULT ('T') NULL,
    [C_DATUM]                     DATETIME       NOT NULL,
    [C_HETIREND]                  INT            NOT NULL,
    [C_HETNAPJA]                  INT            NULL,
    [C_MEGJEGYZES]                NVARCHAR (255) NULL,
    [C_NAPTIPUSA]                 INT            NOT NULL,
    [C_ORARENDINAP]               CHAR (1)       DEFAULT ('T') NULL,
    [C_OSSZESCSOPORTRAVONATKOZIK] CHAR (1)       DEFAULT ('F') NULL,
    [C_EGYEDINAP]                 CHAR (1)       DEFAULT ('F') NOT NULL,
    [C_CSENGETESIRENDID]          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,
    [CSOP]                        CHAR (1)       NULL,
    CONSTRAINT [tmp_ms_xx_constraint_PK_T_40254411] PRIMARY KEY CLUSTERED ([ID] ASC)
);

IF EXISTS (SELECT TOP 1 1 
           FROM   [dbo].[T_TANEVRENDJE])
    BEGIN
        SET IDENTITY_INSERT [dbo].[tmp_ms_xx_T_TANEVRENDJE] ON;
        INSERT INTO [dbo].[tmp_ms_xx_T_TANEVRENDJE] ([ID], [C_AKTIV], [C_DATUM], [C_HETIREND], [C_HETNAPJA], [C_MEGJEGYZES], [C_NAPTIPUSA], [C_ORARENDINAP], [C_OSSZESCSOPORTRAVONATKOZIK], [C_CSENGETESIRENDID], [C_INTEZMENYID], [C_TANEVID], [TOROLT], [SERIAL], [LASTCHANGED], [CREATED], [MODIFIER], [CREATOR], [ELOZOTANEVIREKORDID], [NNID], [CSOP])
        SELECT   [ID],
                 [C_AKTIV],
                 [C_DATUM],
                 [C_HETIREND],
                 [C_HETNAPJA],
                 [C_MEGJEGYZES],
                 [C_NAPTIPUSA],
                 [C_ORARENDINAP],
                 [C_OSSZESCSOPORTRAVONATKOZIK],
                 [C_CSENGETESIRENDID],
                 [C_INTEZMENYID],
                 [C_TANEVID],
                 [TOROLT],
                 [SERIAL],
                 [LASTCHANGED],
                 [CREATED],
                 [MODIFIER],
                 [CREATOR],
                 [ELOZOTANEVIREKORDID],
                 [NNID],
                 [CSOP]
        FROM     [dbo].[T_TANEVRENDJE]
        ORDER BY [ID] ASC;
        SET IDENTITY_INSERT [dbo].[tmp_ms_xx_T_TANEVRENDJE] OFF;
    END

DROP TABLE [dbo].[T_TANEVRENDJE];

EXECUTE sp_rename N'[dbo].[tmp_ms_xx_T_TANEVRENDJE]', N'T_TANEVRENDJE';

EXECUTE sp_rename N'[dbo].[tmp_ms_xx_constraint_PK_T_40254411]', N'PK_T_4025441', N'OBJECT';

COMMIT TRANSACTION;

SET TRANSACTION ISOLATION LEVEL READ COMMITTED;


GO
PRINT N'Creating [dbo].[T_TANEVRENDJE].[I_T_4025441_4025444]...';


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


GO
PRINT N'Creating [dbo].[T_TANEVRENDJE].[I_T_4025441_4025445]...';


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


GO
PRINT N'Creating [dbo].[T_TANEVRENDJE].[I_T_4025441_4025447]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025441_4025447]
    ON [dbo].[T_TANEVRENDJE]([C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_NAPTIPUSA] ASC);


GO
PRINT N'Creating [dbo].[T_TANEVRENDJE].[I_T_4026086_4026085]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4026086_4026085]
    ON [dbo].[T_TANEVRENDJE]([C_CSENGETESIRENDID] ASC);


GO
PRINT N'Creating [dbo].[T_TANEVRENDJE].[I_T_402544102_402544100]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402544102_402544100]
    ON [dbo].[T_TANEVRENDJE]([C_INTEZMENYID] ASC);


GO
PRINT N'Creating [dbo].[T_TANEVRENDJE].[I_T_402544105_402544103]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402544105_402544103]
    ON [dbo].[T_TANEVRENDJE]([C_TANEVID] ASC);


GO
PRINT N'Creating [dbo].[T_TANEVRENDJE].[NCI_TanevRendje_IntezmenyId_NapTipusa_TanevId_Datum]...';


GO
CREATE NONCLUSTERED INDEX [NCI_TanevRendje_IntezmenyId_NapTipusa_TanevId_Datum]
    ON [dbo].[T_TANEVRENDJE]([C_INTEZMENYID] ASC, [C_NAPTIPUSA] ASC, [C_TANEVID] ASC, [C_DATUM] ASC)
    INCLUDE([C_ORARENDINAP], [C_OSSZESCSOPORTRAVONATKOZIK], [C_CSENGETESIRENDID]) WHERE ([TOROLT]='F') WITH (FILLFACTOR = 80);


GO
PRINT N'Creating [dbo].[T_TANEVRENDJE].[NCI_TanevRendje_Datum_IntezmenyId_TanevId]...';


GO
CREATE NONCLUSTERED INDEX [NCI_TanevRendje_Datum_IntezmenyId_TanevId]
    ON [dbo].[T_TANEVRENDJE]([C_DATUM] ASC, [C_TANEVID] ASC, [C_INTEZMENYID] ASC)
    INCLUDE([C_OSSZESCSOPORTRAVONATKOZIK], [C_CSENGETESIRENDID]) WHERE ([TOROLT]='F') WITH (FILLFACTOR = 80);


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 (500)  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_KOMPLEXORA]               CHAR (1)        DEFAULT ('F') NOT NULL,
    [C_KIPORA]                   CHAR (1)        DEFAULT ('F') NOT NULL,
    [C_VEKOP73317]               CHAR (1)        DEFAULT ('F') NOT NULL,
    [C_KAPORA]                   CHAR (1)        DEFAULT ('F') NOT NULL,
    [C_GINOP623]                 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_EFOP32317], [C_MULTIKULTURALISORA], [C_KOMPLEXORA], [C_KIPORA], [C_VEKOP73317], [C_KAPORA], [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_EFOP32317],
                 [C_MULTIKULTURALISORA],
                 [C_KOMPLEXORA],
                 [C_KIPORA],
                 [C_VEKOP73317],
                 [C_KAPORA],
                 [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].[NCI_TanitasiOra_TantargyId_Datum_IntezmenyId_TanevId]...';


GO
CREATE NONCLUSTERED INDEX [NCI_TanitasiOra_TantargyId_Datum_IntezmenyId_TanevId]
    ON [dbo].[T_TANITASIORA]([C_TANTARGYID] ASC, [C_DATUM] ASC, [C_INTEZMENYID] ASC, [C_TANEVID] ASC)
    INCLUDE([C_CSENGETESIRENDID]) WHERE ([TOROLT]='F') WITH (FILLFACTOR = 80);


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


GO
CREATE NONCLUSTERED INDEX [NCI_TanitasiOra_IntezmenyId_TanevId_TeremId]
    ON [dbo].[T_TANITASIORA]([C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_TEREMID] ASC) WHERE ([TOROLT]='F') WITH (FILLFACTOR = 80);


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


GO
CREATE NONCLUSTERED INDEX [NCI_TanitasiOra_TantargyId_OsztalycsoportId_OraKezdete_IntezmenyId_TanevId]
    ON [dbo].[T_TANITASIORA]([C_TANTARGYID] ASC, [C_OSZTALYCSOPORTID] ASC, [C_ORAKEZDETE] ASC, [C_INTEZMENYID] ASC, [C_TANEVID] ASC) WHERE ([TOROLT]='F') WITH (FILLFACTOR = 80);


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


GO
CREATE NONCLUSTERED INDEX [NCI_TanitasiOra_OsztalyCsoportId_IntezmenyId_TanevId_TantargyId]
    ON [dbo].[T_TANITASIORA]([C_OSZTALYCSOPORTID] ASC, [C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_TANTARGYID] ASC)
    INCLUDE([C_DATUM]) WHERE ([TOROLT]='F') WITH (FILLFACTOR = 80);


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


GO
CREATE NONCLUSTERED INDEX [NCI_TanitasiOra_Datum_OsztalyCsoportId_TanevId_IntezmenyId]
    ON [dbo].[T_TANITASIORA]([C_DATUM] ASC, [C_OSZTALYCSOPORTID] ASC, [C_TANEVID] ASC, [C_INTEZMENYID] ASC)
    INCLUDE([C_CSENGETESIRENDID]) WHERE ([TOROLT]='F') WITH (FILLFACTOR = 80);


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


GO
CREATE NONCLUSTERED INDEX [NCI_TanitasiOra_TantargyId_OsztalyCsoportId_TanarId]
    ON [dbo].[T_TANITASIORA]([C_TANTARGYID] ASC, [C_OSZTALYCSOPORTID] ASC, [C_TANARID] ASC)
    INCLUDE([C_MEGTARTOTT], [C_SORSZAMOZANDO], [C_ORAKEZDETE], [C_INTEZMENYID], [C_TANEVID]) WHERE ([TOROLT]='F') WITH (FILLFACTOR = 80);


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


GO
CREATE NONCLUSTERED INDEX [NCI_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') WITH (FILLFACTOR = 80);


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


GO
CREATE NONCLUSTERED INDEX [NCI_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') WITH (FILLFACTOR = 80);


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


GO
CREATE NONCLUSTERED INDEX [NCI_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) WHERE ([TOROLT]='F') WITH (FILLFACTOR = 80);


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


GO
CREATE NONCLUSTERED INDEX [NCI_TanitasiOra_TeremId_Datum_IntezmenyId_TanevId_CsengetesiRendId]
    ON [dbo].[T_TANITASIORA]([C_TEREMID] ASC, [C_DATUM] ASC, [C_INTEZMENYID] ASC, [C_TANEVID] ASC)
    INCLUDE([C_CSENGETESIRENDID]) WHERE ([TOROLT]='F') WITH (FILLFACTOR = 80);


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


GO
CREATE TABLE [dbo].[T_DOKUMENTUM] (
    [ID]                     INT             IDENTITY (1, 1) NOT NULL,
    [C_TARTALOM]             VARBINARY (MAX) NOT NULL,
    [C_TARTALOMTIPUS]        NVARCHAR (100)  NOT NULL,
    [C_IKTATOTTDOKUMENTUMID] INT             NOT NULL,
    [C_INTEZMENYID]          INT             NOT NULL,
    [C_TANEVID]              INT             NOT NULL,
    [TOROLT]                 CHAR (1)        NOT NULL,
    [SERIAL]                 INT             NOT NULL,
    [LASTCHANGED]            DATETIME        NOT NULL,
    [CREATED]                DATETIME        NOT NULL,
    [MODIFIER]               INT             NULL,
    [CREATOR]                INT             NULL,
    [ELOZOTANEVIREKORDID]    INT             NULL,
    [NNID]                   INT             NULL,
    CONSTRAINT [PK_T_4028579] PRIMARY KEY CLUSTERED ([ID] ASC)
);


GO
PRINT N'Creating [dbo].[T_DOKUMENTUM].[I_T_4028586_4028584]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4028586_4028584]
    ON [dbo].[T_DOKUMENTUM]([C_IKTATOTTDOKUMENTUMID] ASC);


GO
PRINT N'Creating [dbo].[T_DOKUMENTUM].[I_T_402857902_402857900]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402857902_402857900]
    ON [dbo].[T_DOKUMENTUM]([C_INTEZMENYID] ASC);


GO
PRINT N'Creating [dbo].[T_DOKUMENTUM].[I_T_402857905_402857903]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402857905_402857903]
    ON [dbo].[T_DOKUMENTUM]([C_TANEVID] ASC);


GO
PRINT N'Creating [dbo].[T_DOKUMENTUM].[UK_4028584]...';


GO
CREATE UNIQUE NONCLUSTERED INDEX [UK_4028584]
    ON [dbo].[T_DOKUMENTUM]([C_IKTATOTTDOKUMENTUMID] ASC, [C_INTEZMENYID] ASC, [C_TANEVID] ASC) WHERE ([TOROLT]='F');


GO
PRINT N'Creating unnamed constraint on [dbo].[T_DOKUMENTUM]...';


GO
ALTER TABLE [dbo].[T_DOKUMENTUM]
    ADD DEFAULT (getdate()) FOR [LASTCHANGED];


GO
PRINT N'Creating unnamed constraint on [dbo].[T_DOKUMENTUM]...';


GO
ALTER TABLE [dbo].[T_DOKUMENTUM]
    ADD DEFAULT (getdate()) FOR [CREATED];


GO
PRINT N'Creating unnamed constraint on [dbo].[T_DOKUMENTUM]...';


GO
ALTER TABLE [dbo].[T_DOKUMENTUM]
    ADD DEFAULT ('F') FOR [TOROLT];


GO
PRINT N'Creating unnamed constraint on [dbo].[T_DOKUMENTUM]...';


GO
ALTER TABLE [dbo].[T_DOKUMENTUM]
    ADD DEFAULT ((0)) FOR [SERIAL];


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


GO
ALTER TABLE [dbo].[T_IKTATOTTDOKUMENTUM] WITH NOCHECK
    ADD CONSTRAINT [FK_4028569_4028567] FOREIGN KEY ([C_FELADATELLATASIHELYID]) REFERENCES [dbo].[T_FELADATELLATASIHELY] ([ID]);


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_IKTATOTTDOKUMENTUM] WITH NOCHECK
    ADD CONSTRAINT [FK_4028544_4028554] FOREIGN KEY ([C_DOKUMENTUMKATEGORIA], [C_INTEZMENYID], [C_TANEVID]) REFERENCES [dbo].[T_DOKUMENTUMKATEGORIA] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


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


GO
ALTER TABLE [dbo].[T_IKTATOTTDOKUMENTUM] WITH NOCHECK
    ADD CONSTRAINT [FK_4028544_4028555] FOREIGN KEY ([C_DOKUMENTUMTIPUS], [C_INTEZMENYID], [C_TANEVID]) REFERENCES [dbo].[T_DOKUMENTUMTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


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


GO
ALTER TABLE [dbo].[T_IKTATOTTDOKUMENTUM] WITH NOCHECK
    ADD CONSTRAINT [FK_4028544_4028556] FOREIGN KEY ([C_DOKUMENTUMSTATUSZ], [C_INTEZMENYID], [C_TANEVID]) REFERENCES [dbo].[T_DOKUMENTUMSTATUSZ] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


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


GO
ALTER TABLE [dbo].[T_DOKUMENTUMKULCSSZO] WITH NOCHECK
    ADD CONSTRAINT [FK_4028563_4028561] FOREIGN KEY ([C_IKTATOTTDOKUMENTUMID]) REFERENCES [dbo].[T_IKTATOTTDOKUMENTUM] ([ID]);


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


GO
ALTER TABLE [dbo].[T_IKTATOTTDOKUMENTUM] WITH NOCHECK
    ADD CONSTRAINT [FK_4028589_4028587] FOREIGN KEY ([C_IKTATOSZEMELYID]) REFERENCES [dbo].[T_FELHASZNALO] ([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_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_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_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_4025515_4025513]...';


GO
ALTER TABLE [dbo].[T_OSZTALYCSOPORT_TANEVRENDJE] WITH NOCHECK
    ADD CONSTRAINT [FK_4025515_4025513] FOREIGN KEY ([C_TANEVRENDJEID]) REFERENCES [dbo].[T_TANEVRENDJE] ([ID]);


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


GO
ALTER TABLE [dbo].[T_TANEVRENDJE] WITH NOCHECK
    ADD CONSTRAINT [FK_4026086_4026085] FOREIGN KEY ([C_CSENGETESIRENDID]) REFERENCES [dbo].[T_CSENGETESIREND] ([ID]);


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


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


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


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


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_TANEVRENDJE] WITH NOCHECK
    ADD CONSTRAINT [FK_4025441_4025447] FOREIGN KEY ([C_NAPTIPUSA], [C_INTEZMENYID], [C_TANEVID]) REFERENCES [dbo].[T_NAPTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


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


GO
ALTER TABLE [dbo].[T_DOKUMENTUM] WITH NOCHECK
    ADD CONSTRAINT [FK_4028586_4028584] FOREIGN KEY ([C_IKTATOTTDOKUMENTUMID]) REFERENCES [dbo].[T_IKTATOTTDOKUMENTUM] ([ID]);


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


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


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


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


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


GO

  CREATE TRIGGER tr_AsyncAuditIKTATOTTDOKUMENTUM
    ON T_IKTATOTTDOKUMENTUM
    WITH EXECUTE AS 'Kreta_tech_user'
    FOR INSERT, UPDATE, DELETE
  AS
  BEGIN
    SET NOCOUNT ON; 

    DECLARE @messageBody nvarchar(max)
    DECLARE @TableId int
    DECLARE @alterationTime datetime = GETDATE()

    --get relevant information from inserted/deleted and convert to xml message
    SET @messageBody = (
      SELECT 'T_IKTATOTTDOKUMENTUM' AS 'name', GETDATE() AS 'alterationTime', 
        JSON_QUERY (
          (SELECT              
             ID AS 'ID' 
            ,C_INTEZMENYID AS 'C_INTEZMENYID'
            ,C_TANEVID AS 'C_TANEVID'
            ,CREATOR AS 'CREATOR'
            ,MODIFIER AS 'MODIFIER'
            ,C_DOKUMENTUMNEVE AS 'col.C_DOKUMENTUMNEVE', C_IKTATOSZAM AS 'col.C_IKTATOSZAM', C_GENERALASDATUMA AS 'col.C_GENERALASDATUMA', C_IKTATASDATUMA AS 'col.C_IKTATASDATUMA', C_ELEKTRONIKUSPELDANYFELTOLTES AS 'col.C_ELEKTRONIKUSPELDANYFELTOLTES', C_ELEKTRONIKUSPELDANYID AS 'col.C_ELEKTRONIKUSPELDANYID', C_GENERALTDOKUMENTUMID AS 'col.C_GENERALTDOKUMENTUMID', C_VONALKOD AS 'col.C_VONALKOD', C_MAPPA AS 'col.C_MAPPA', C_DOKUMENTUMKATEGORIA AS 'col.C_DOKUMENTUMKATEGORIA', C_DOKUMENTUMTIPUS AS 'col.C_DOKUMENTUMTIPUS', C_DOKUMENTUMSTATUSZ AS 'col.C_DOKUMENTUMSTATUSZ', C_FELADATELLATASIHELYID AS 'col.C_FELADATELLATASIHELYID', C_IKTATOSZEMELYID AS 'col.C_IKTATOSZEMELYID', TOROLT AS 'col.TOROLT', MODIFIER AS 'col.MODIFIER', CREATOR AS 'col.CREATOR', ELOZOTANEVIREKORDID AS 'col.ELOZOTANEVIREKORDID'
          FROM inserted
          FOR JSON PATH, ROOT('audit'), INCLUDE_NULL_VALUES), '$.audit'
        ) AS 'inserted',
        JSON_QUERY (
          (SELECT              
             ID AS 'ID' 
            ,C_INTEZMENYID AS 'C_INTEZMENYID'
            ,C_TANEVID AS 'C_TANEVID'
            ,CREATOR AS 'CREATOR'
            ,MODIFIER AS 'MODIFIER'
            ,C_DOKUMENTUMNEVE AS 'col.C_DOKUMENTUMNEVE', C_IKTATOSZAM AS 'col.C_IKTATOSZAM', C_GENERALASDATUMA AS 'col.C_GENERALASDATUMA', C_IKTATASDATUMA AS 'col.C_IKTATASDATUMA', C_ELEKTRONIKUSPELDANYFELTOLTES AS 'col.C_ELEKTRONIKUSPELDANYFELTOLTES', C_ELEKTRONIKUSPELDANYID AS 'col.C_ELEKTRONIKUSPELDANYID', C_GENERALTDOKUMENTUMID AS 'col.C_GENERALTDOKUMENTUMID', C_VONALKOD AS 'col.C_VONALKOD', C_MAPPA AS 'col.C_MAPPA', C_DOKUMENTUMKATEGORIA AS 'col.C_DOKUMENTUMKATEGORIA', C_DOKUMENTUMTIPUS AS 'col.C_DOKUMENTUMTIPUS', C_DOKUMENTUMSTATUSZ AS 'col.C_DOKUMENTUMSTATUSZ', C_FELADATELLATASIHELYID AS 'col.C_FELADATELLATASIHELYID', C_IKTATOSZEMELYID AS 'col.C_IKTATOSZEMELYID', TOROLT AS 'col.TOROLT', MODIFIER AS 'col.MODIFIER', CREATOR AS 'col.CREATOR', ELOZOTANEVIREKORDID AS 'col.ELOZOTANEVIREKORDID'
          FROM deleted
          FOR JSON PATH, ROOT('audit'), INCLUDE_NULL_VALUES), '$.audit'
        ) AS 'deleted'      
      FOR JSON PATH, WITHOUT_ARRAY_WRAPPER, INCLUDE_NULL_VALUES
    )

    IF (@messageBody IS NOT NULL) BEGIN
      BEGIN TRY
    	  EXEC [auditlog].[usp_send] 
    	    @fromService = 'AuditService',
    	    @toService = 'AuditService',
    	    @onContract = 'AuditContract',
    	    @messageType = 'AuditMessage',
    	    @messageBody = @messageBody
        INSERT INTO auditlog.XmlAudit (MessageBody, InsertedAt)
        VALUES (@messageBody, ISNULL(@alterationTime, GETDATE()))
	    END TRY
      BEGIN CATCH
        INSERT INTO auditlog.XmlAudit (MessageBody, InsertedAt)
        VALUES (@messageBody, ISNULL(@alterationTime, GETDATE()))      
      END CATCH
    END
  END
GO
PRINT N'Creating [dbo].[tr_AsyncAuditORARENDIORA]...';


GO

  CREATE TRIGGER tr_AsyncAuditORARENDIORA
    ON T_ORARENDIORA
    WITH EXECUTE AS 'Kreta_tech_user'
    FOR INSERT, UPDATE, DELETE
  AS
  BEGIN
    SET NOCOUNT ON; 

    DECLARE @messageBody nvarchar(max)
    DECLARE @TableId int
    DECLARE @alterationTime datetime = GETDATE()

    --get relevant information from inserted/deleted and convert to xml message
    SET @messageBody = (
      SELECT 'T_ORARENDIORA' AS 'name', GETDATE() AS 'alterationTime', 
        JSON_QUERY (
          (SELECT              
             ID AS 'ID' 
            ,C_INTEZMENYID AS 'C_INTEZMENYID'
            ,C_TANEVID AS 'C_TANEVID'
            ,CREATOR AS 'CREATOR'
            ,MODIFIER AS 'MODIFIER'
            ,C_DIFFERENCIALT AS 'col.C_DIFFERENCIALT', C_DRAMA AS 'col.C_DRAMA', C_HETIREND AS 'col.C_HETIREND', C_HETNAPJA AS 'col.C_HETNAPJA', C_IKTTANORA AS 'col.C_IKTTANORA', C_IPRTANORA AS 'col.C_IPRTANORA', C_KOOPERATIV AS 'col.C_KOOPERATIV', C_MERES AS 'col.C_MERES', C_MINDENNAPOSTESTNEVELES AS 'col.C_MINDENNAPOSTESTNEVELES', C_NEMSZAKRENDSZERUORA AS 'col.C_NEMSZAKRENDSZERUORA', C_NEMZETISEGIORA AS 'col.C_NEMZETISEGIORA', C_ORASZAM AS 'col.C_ORASZAM', C_SORSZAMOZANDO AS 'col.C_SORSZAMOZANDO', C_TAMOPORA AS 'col.C_TAMOPORA', C_TULORA AS 'col.C_TULORA', C_BONTOTT AS 'col.C_BONTOTT', C_ORAERVENYESSEGKEZDETE AS 'col.C_ORAERVENYESSEGKEZDETE', C_ORAERVENYESSEGVEGE AS 'col.C_ORAERVENYESSEGVEGE', C_PARHUZAMOSORA AS 'col.C_PARHUZAMOSORA', C_TIOP12 AS 'col.C_TIOP12', C_ORAKEZDETE AS 'col.C_ORAKEZDETE', C_ORAVEGE AS 'col.C_ORAVEGE', C_TANORANKIVULIFOGLALKOZAS AS 'col.C_TANORANKIVULIFOGLALKOZAS', C_IMPORTALT AS 'col.C_IMPORTALT', C_CSENGETESIRENDID AS 'col.C_CSENGETESIRENDID', C_CSENGETESIRENDORAID AS 'col.C_CSENGETESIRENDORAID', C_ORARENDIORAGROUPID AS 'col.C_ORARENDIORAGROUPID', C_EFOP32317 AS 'col.C_EFOP32317', C_MULTIKULTURALISORA AS 'col.C_MULTIKULTURALISORA', C_KOMPLEXORA AS 'col.C_KOMPLEXORA', C_KIPORA AS 'col.C_KIPORA', C_VEKOP73317 AS 'col.C_VEKOP73317', C_KAPORA AS 'col.C_KAPORA', C_GINOP623 AS 'col.C_GINOP623', C_EGYEDINAP AS 'col.C_EGYEDINAP', C_TEREMID AS 'col.C_TEREMID', C_FOGLALKOZASID AS 'col.C_FOGLALKOZASID', C_TANTARGYID AS 'col.C_TANTARGYID', C_OSZTALYCSOPORTID AS 'col.C_OSZTALYCSOPORTID', C_TANARID AS 'col.C_TANARID', C_ORATULAJDONOSID AS 'col.C_ORATULAJDONOSID', TOROLT AS 'col.TOROLT', MODIFIER AS 'col.MODIFIER', CREATOR AS 'col.CREATOR', ELOZOTANEVIREKORDID AS 'col.ELOZOTANEVIREKORDID'
          FROM inserted
          FOR JSON PATH, ROOT('audit'), INCLUDE_NULL_VALUES), '$.audit'
        ) AS 'inserted',
        JSON_QUERY (
          (SELECT              
             ID AS 'ID' 
            ,C_INTEZMENYID AS 'C_INTEZMENYID'
            ,C_TANEVID AS 'C_TANEVID'
            ,CREATOR AS 'CREATOR'
            ,MODIFIER AS 'MODIFIER'
            ,C_DIFFERENCIALT AS 'col.C_DIFFERENCIALT', C_DRAMA AS 'col.C_DRAMA', C_HETIREND AS 'col.C_HETIREND', C_HETNAPJA AS 'col.C_HETNAPJA', C_IKTTANORA AS 'col.C_IKTTANORA', C_IPRTANORA AS 'col.C_IPRTANORA', C_KOOPERATIV AS 'col.C_KOOPERATIV', C_MERES AS 'col.C_MERES', C_MINDENNAPOSTESTNEVELES AS 'col.C_MINDENNAPOSTESTNEVELES', C_NEMSZAKRENDSZERUORA AS 'col.C_NEMSZAKRENDSZERUORA', C_NEMZETISEGIORA AS 'col.C_NEMZETISEGIORA', C_ORASZAM AS 'col.C_ORASZAM', C_SORSZAMOZANDO AS 'col.C_SORSZAMOZANDO', C_TAMOPORA AS 'col.C_TAMOPORA', C_TULORA AS 'col.C_TULORA', C_BONTOTT AS 'col.C_BONTOTT', C_ORAERVENYESSEGKEZDETE AS 'col.C_ORAERVENYESSEGKEZDETE', C_ORAERVENYESSEGVEGE AS 'col.C_ORAERVENYESSEGVEGE', C_PARHUZAMOSORA AS 'col.C_PARHUZAMOSORA', C_TIOP12 AS 'col.C_TIOP12', C_ORAKEZDETE AS 'col.C_ORAKEZDETE', C_ORAVEGE AS 'col.C_ORAVEGE', C_TANORANKIVULIFOGLALKOZAS AS 'col.C_TANORANKIVULIFOGLALKOZAS', C_IMPORTALT AS 'col.C_IMPORTALT', C_CSENGETESIRENDID AS 'col.C_CSENGETESIRENDID', C_CSENGETESIRENDORAID AS 'col.C_CSENGETESIRENDORAID', C_ORARENDIORAGROUPID AS 'col.C_ORARENDIORAGROUPID', C_EFOP32317 AS 'col.C_EFOP32317', C_MULTIKULTURALISORA AS 'col.C_MULTIKULTURALISORA', C_KOMPLEXORA AS 'col.C_KOMPLEXORA', C_KIPORA AS 'col.C_KIPORA', C_VEKOP73317 AS 'col.C_VEKOP73317', C_KAPORA AS 'col.C_KAPORA', C_GINOP623 AS 'col.C_GINOP623', C_EGYEDINAP AS 'col.C_EGYEDINAP', C_TEREMID AS 'col.C_TEREMID', C_FOGLALKOZASID AS 'col.C_FOGLALKOZASID', C_TANTARGYID AS 'col.C_TANTARGYID', C_OSZTALYCSOPORTID AS 'col.C_OSZTALYCSOPORTID', C_TANARID AS 'col.C_TANARID', C_ORATULAJDONOSID AS 'col.C_ORATULAJDONOSID', TOROLT AS 'col.TOROLT', MODIFIER AS 'col.MODIFIER', CREATOR AS 'col.CREATOR', ELOZOTANEVIREKORDID AS 'col.ELOZOTANEVIREKORDID'
          FROM deleted
          FOR JSON PATH, ROOT('audit'), INCLUDE_NULL_VALUES), '$.audit'
        ) AS 'deleted'      
      FOR JSON PATH, WITHOUT_ARRAY_WRAPPER, INCLUDE_NULL_VALUES
    )

    IF (@messageBody IS NOT NULL) BEGIN
      BEGIN TRY
    	  EXEC [auditlog].[usp_send] 
    	    @fromService = 'AuditService',
    	    @toService = 'AuditService',
    	    @onContract = 'AuditContract',
    	    @messageType = 'AuditMessage',
    	    @messageBody = @messageBody
        INSERT INTO auditlog.XmlAudit (MessageBody, InsertedAt)
        VALUES (@messageBody, ISNULL(@alterationTime, GETDATE()))
	    END TRY
      BEGIN CATCH
        INSERT INTO auditlog.XmlAudit (MessageBody, InsertedAt)
        VALUES (@messageBody, ISNULL(@alterationTime, GETDATE()))      
      END CATCH
    END
  END
GO
PRINT N'Creating [dbo].[tr_AsyncAuditTANEVRENDJE]...';


GO

  CREATE TRIGGER tr_AsyncAuditTANEVRENDJE
    ON T_TANEVRENDJE
    WITH EXECUTE AS 'Kreta_tech_user'
    FOR INSERT, UPDATE, DELETE
  AS
  BEGIN
    SET NOCOUNT ON; 

    DECLARE @messageBody nvarchar(max)
    DECLARE @TableId int
    DECLARE @alterationTime datetime = GETDATE()

    --get relevant information from inserted/deleted and convert to xml message
    SET @messageBody = (
      SELECT 'T_TANEVRENDJE' AS 'name', GETDATE() AS 'alterationTime', 
        JSON_QUERY (
          (SELECT              
             ID AS 'ID' 
            ,C_INTEZMENYID AS 'C_INTEZMENYID'
            ,C_TANEVID AS 'C_TANEVID'
            ,CREATOR AS 'CREATOR'
            ,MODIFIER AS 'MODIFIER'
            ,C_AKTIV AS 'col.C_AKTIV', C_DATUM AS 'col.C_DATUM', C_HETIREND AS 'col.C_HETIREND', C_HETNAPJA AS 'col.C_HETNAPJA', C_MEGJEGYZES AS 'col.C_MEGJEGYZES', C_NAPTIPUSA AS 'col.C_NAPTIPUSA', C_ORARENDINAP AS 'col.C_ORARENDINAP', C_OSSZESCSOPORTRAVONATKOZIK AS 'col.C_OSSZESCSOPORTRAVONATKOZIK', C_EGYEDINAP AS 'col.C_EGYEDINAP', C_CSENGETESIRENDID AS 'col.C_CSENGETESIRENDID', TOROLT AS 'col.TOROLT', MODIFIER AS 'col.MODIFIER', CREATOR AS 'col.CREATOR', ELOZOTANEVIREKORDID AS 'col.ELOZOTANEVIREKORDID', CSOP AS 'col.CSOP'
          FROM inserted
          FOR JSON PATH, ROOT('audit'), INCLUDE_NULL_VALUES), '$.audit'
        ) AS 'inserted',
        JSON_QUERY (
          (SELECT              
             ID AS 'ID' 
            ,C_INTEZMENYID AS 'C_INTEZMENYID'
            ,C_TANEVID AS 'C_TANEVID'
            ,CREATOR AS 'CREATOR'
            ,MODIFIER AS 'MODIFIER'
            ,C_AKTIV AS 'col.C_AKTIV', C_DATUM AS 'col.C_DATUM', C_HETIREND AS 'col.C_HETIREND', C_HETNAPJA AS 'col.C_HETNAPJA', C_MEGJEGYZES AS 'col.C_MEGJEGYZES', C_NAPTIPUSA AS 'col.C_NAPTIPUSA', C_ORARENDINAP AS 'col.C_ORARENDINAP', C_OSSZESCSOPORTRAVONATKOZIK AS 'col.C_OSSZESCSOPORTRAVONATKOZIK', C_EGYEDINAP AS 'col.C_EGYEDINAP', C_CSENGETESIRENDID AS 'col.C_CSENGETESIRENDID', TOROLT AS 'col.TOROLT', MODIFIER AS 'col.MODIFIER', CREATOR AS 'col.CREATOR', ELOZOTANEVIREKORDID AS 'col.ELOZOTANEVIREKORDID', CSOP AS 'col.CSOP'
          FROM deleted
          FOR JSON PATH, ROOT('audit'), INCLUDE_NULL_VALUES), '$.audit'
        ) AS 'deleted'      
      FOR JSON PATH, WITHOUT_ARRAY_WRAPPER, INCLUDE_NULL_VALUES
    )

    IF (@messageBody IS NOT NULL) BEGIN
      BEGIN TRY
    	  EXEC [auditlog].[usp_send] 
    	    @fromService = 'AuditService',
    	    @toService = 'AuditService',
    	    @onContract = 'AuditContract',
    	    @messageType = 'AuditMessage',
    	    @messageBody = @messageBody
        INSERT INTO auditlog.XmlAudit (MessageBody, InsertedAt)
        VALUES (@messageBody, ISNULL(@alterationTime, GETDATE()))
	    END TRY
      BEGIN CATCH
        INSERT INTO auditlog.XmlAudit (MessageBody, InsertedAt)
        VALUES (@messageBody, ISNULL(@alterationTime, GETDATE()))      
      END CATCH
    END
  END
GO
PRINT N'Creating [dbo].[tr_AsyncAuditTANITASIORA]...';


GO

  CREATE TRIGGER tr_AsyncAuditTANITASIORA
    ON T_TANITASIORA
    WITH EXECUTE AS 'Kreta_tech_user'
    FOR INSERT, UPDATE, DELETE
  AS
  BEGIN
    SET NOCOUNT ON; 

    DECLARE @messageBody nvarchar(max)
    DECLARE @TableId int
    DECLARE @alterationTime datetime = GETDATE()

    --get relevant information from inserted/deleted and convert to xml message
    SET @messageBody = (
      SELECT 'T_TANITASIORA' AS 'name', GETDATE() AS 'alterationTime', 
        JSON_QUERY (
          (SELECT              
             ID AS 'ID' 
            ,C_INTEZMENYID AS 'C_INTEZMENYID'
            ,C_TANEVID AS 'C_TANEVID'
            ,CREATOR AS 'CREATOR'
            ,MODIFIER AS 'MODIFIER'
            ,C_BEJEGYZESIDEJE AS 'col.C_BEJEGYZESIDEJE', C_BONTOTT AS 'col.C_BONTOTT', C_DATUM AS 'col.C_DATUM', C_HELYETTESITESOKA AS 'col.C_HELYETTESITESOKA', C_HELYETTESITESTIPUSA AS 'col.C_HELYETTESITESTIPUSA', C_HETNAPJA AS 'col.C_HETNAPJA', C_HETSORSZAMA AS 'col.C_HETSORSZAMA', C_IKTTANORA AS 'col.C_IKTTANORA', C_MEGJEGYZES AS 'col.C_MEGJEGYZES', C_MEGTARTOTT AS 'col.C_MEGTARTOTT', C_NAPSORSZAMA AS 'col.C_NAPSORSZAMA', C_NEMSZAKRENDSZERUORA AS 'col.C_NEMSZAKRENDSZERUORA', C_ORAKEZDETE AS 'col.C_ORAKEZDETE', C_ORASZAM AS 'col.C_ORASZAM', C_ORAVEGE AS 'col.C_ORAVEGE', C_SORSZAMOZANDO AS 'col.C_SORSZAMOZANDO', C_TAMOPORA AS 'col.C_TAMOPORA', C_TEMA AS 'col.C_TEMA', C_TULORA AS 'col.C_TULORA', C_OSZTALYFONOKI AS 'col.C_OSZTALYFONOKI', C_TANORANKIVULIFOGLALKOZAS AS 'col.C_TANORANKIVULIFOGLALKOZAS', C_HAZIFELADAT AS 'col.C_HAZIFELADAT', C_DIFFERENCIALT AS 'col.C_DIFFERENCIALT', C_DRAMA AS 'col.C_DRAMA', C_IPRTANORA AS 'col.C_IPRTANORA', C_KOOPERATIV AS 'col.C_KOOPERATIV', C_MERES AS 'col.C_MERES', C_MINDENNAPOSTESTNEVELES AS 'col.C_MINDENNAPOSTESTNEVELES', C_NEMZETISEGIORA AS 'col.C_NEMZETISEGIORA', C_PARHUZAMOSORA AS 'col.C_PARHUZAMOSORA', C_TIOP12 AS 'col.C_TIOP12', C_ADMINALTALKIIRT AS 'col.C_ADMINALTALKIIRT', C_CSENGETESIRENDID AS 'col.C_CSENGETESIRENDID', C_CSENGETESIRENDORAID AS 'col.C_CSENGETESIRENDORAID', C_ORAOSSZEVONASID AS 'col.C_ORAOSSZEVONASID', C_ORARENDIORAGROUPID AS 'col.C_ORARENDIORAGROUPID', C_MOBILNAPLOZOTT AS 'col.C_MOBILNAPLOZOTT', C_EFOP32317 AS 'col.C_EFOP32317', C_MULTIKULTURALISORA AS 'col.C_MULTIKULTURALISORA', C_KOMPLEXORA AS 'col.C_KOMPLEXORA', C_KIPORA AS 'col.C_KIPORA', C_VEKOP73317 AS 'col.C_VEKOP73317', C_KAPORA AS 'col.C_KAPORA', C_GINOP623 AS 'col.C_GINOP623', C_TANMENETID AS 'col.C_TANMENETID', C_TANTARGYID AS 'col.C_TANTARGYID', C_NAPTARINAPID AS 'col.C_NAPTARINAPID', C_ORARENDIORAID AS 'col.C_ORARENDIORAID', C_FOGLALKOZASID AS 'col.C_FOGLALKOZASID', C_HELYETTESITOTANARID AS 'col.C_HELYETTESITOTANARID', C_TANARID AS 'col.C_TANARID', C_TEREMID AS 'col.C_TEREMID', C_OSZTALYCSOPORTID AS 'col.C_OSZTALYCSOPORTID', C_ORATULAJDONOSID AS 'col.C_ORATULAJDONOSID', C_UPLOADEDFILEID AS 'col.C_UPLOADEDFILEID', TOROLT AS 'col.TOROLT', MODIFIER AS 'col.MODIFIER', CREATOR AS 'col.CREATOR', ELOZOTANEVIREKORDID AS 'col.ELOZOTANEVIREKORDID'
          FROM inserted
          FOR JSON PATH, ROOT('audit'), INCLUDE_NULL_VALUES), '$.audit'
        ) AS 'inserted',
        JSON_QUERY (
          (SELECT              
             ID AS 'ID' 
            ,C_INTEZMENYID AS 'C_INTEZMENYID'
            ,C_TANEVID AS 'C_TANEVID'
            ,CREATOR AS 'CREATOR'
            ,MODIFIER AS 'MODIFIER'
            ,C_BEJEGYZESIDEJE AS 'col.C_BEJEGYZESIDEJE', C_BONTOTT AS 'col.C_BONTOTT', C_DATUM AS 'col.C_DATUM', C_HELYETTESITESOKA AS 'col.C_HELYETTESITESOKA', C_HELYETTESITESTIPUSA AS 'col.C_HELYETTESITESTIPUSA', C_HETNAPJA AS 'col.C_HETNAPJA', C_HETSORSZAMA AS 'col.C_HETSORSZAMA', C_IKTTANORA AS 'col.C_IKTTANORA', C_MEGJEGYZES AS 'col.C_MEGJEGYZES', C_MEGTARTOTT AS 'col.C_MEGTARTOTT', C_NAPSORSZAMA AS 'col.C_NAPSORSZAMA', C_NEMSZAKRENDSZERUORA AS 'col.C_NEMSZAKRENDSZERUORA', C_ORAKEZDETE AS 'col.C_ORAKEZDETE', C_ORASZAM AS 'col.C_ORASZAM', C_ORAVEGE AS 'col.C_ORAVEGE', C_SORSZAMOZANDO AS 'col.C_SORSZAMOZANDO', C_TAMOPORA AS 'col.C_TAMOPORA', C_TEMA AS 'col.C_TEMA', C_TULORA AS 'col.C_TULORA', C_OSZTALYFONOKI AS 'col.C_OSZTALYFONOKI', C_TANORANKIVULIFOGLALKOZAS AS 'col.C_TANORANKIVULIFOGLALKOZAS', C_HAZIFELADAT AS 'col.C_HAZIFELADAT', C_DIFFERENCIALT AS 'col.C_DIFFERENCIALT', C_DRAMA AS 'col.C_DRAMA', C_IPRTANORA AS 'col.C_IPRTANORA', C_KOOPERATIV AS 'col.C_KOOPERATIV', C_MERES AS 'col.C_MERES', C_MINDENNAPOSTESTNEVELES AS 'col.C_MINDENNAPOSTESTNEVELES', C_NEMZETISEGIORA AS 'col.C_NEMZETISEGIORA', C_PARHUZAMOSORA AS 'col.C_PARHUZAMOSORA', C_TIOP12 AS 'col.C_TIOP12', C_ADMINALTALKIIRT AS 'col.C_ADMINALTALKIIRT', C_CSENGETESIRENDID AS 'col.C_CSENGETESIRENDID', C_CSENGETESIRENDORAID AS 'col.C_CSENGETESIRENDORAID', C_ORAOSSZEVONASID AS 'col.C_ORAOSSZEVONASID', C_ORARENDIORAGROUPID AS 'col.C_ORARENDIORAGROUPID', C_MOBILNAPLOZOTT AS 'col.C_MOBILNAPLOZOTT', C_EFOP32317 AS 'col.C_EFOP32317', C_MULTIKULTURALISORA AS 'col.C_MULTIKULTURALISORA', C_KOMPLEXORA AS 'col.C_KOMPLEXORA', C_KIPORA AS 'col.C_KIPORA', C_VEKOP73317 AS 'col.C_VEKOP73317', C_KAPORA AS 'col.C_KAPORA', C_GINOP623 AS 'col.C_GINOP623', C_TANMENETID AS 'col.C_TANMENETID', C_TANTARGYID AS 'col.C_TANTARGYID', C_NAPTARINAPID AS 'col.C_NAPTARINAPID', C_ORARENDIORAID AS 'col.C_ORARENDIORAID', C_FOGLALKOZASID AS 'col.C_FOGLALKOZASID', C_HELYETTESITOTANARID AS 'col.C_HELYETTESITOTANARID', C_TANARID AS 'col.C_TANARID', C_TEREMID AS 'col.C_TEREMID', C_OSZTALYCSOPORTID AS 'col.C_OSZTALYCSOPORTID', C_ORATULAJDONOSID AS 'col.C_ORATULAJDONOSID', C_UPLOADEDFILEID AS 'col.C_UPLOADEDFILEID', TOROLT AS 'col.TOROLT', MODIFIER AS 'col.MODIFIER', CREATOR AS 'col.CREATOR', ELOZOTANEVIREKORDID AS 'col.ELOZOTANEVIREKORDID'
          FROM deleted
          FOR JSON PATH, ROOT('audit'), INCLUDE_NULL_VALUES), '$.audit'
        ) AS 'deleted'      
      FOR JSON PATH, WITHOUT_ARRAY_WRAPPER, INCLUDE_NULL_VALUES
    )

    IF (@messageBody IS NOT NULL) BEGIN
      BEGIN TRY
    	  EXEC [auditlog].[usp_send] 
    	    @fromService = 'AuditService',
    	    @toService = 'AuditService',
    	    @onContract = 'AuditContract',
    	    @messageType = 'AuditMessage',
    	    @messageBody = @messageBody
        INSERT INTO auditlog.XmlAudit (MessageBody, InsertedAt)
        VALUES (@messageBody, ISNULL(@alterationTime, GETDATE()))
	    END TRY
      BEGIN CATCH
        INSERT INTO auditlog.XmlAudit (MessageBody, InsertedAt)
        VALUES (@messageBody, ISNULL(@alterationTime, GETDATE()))      
      END CATCH
    END
  END
GO
PRINT N'Creating [dbo].[tr_AsyncAuditDOKUMENTUM]...';


GO

  CREATE TRIGGER tr_AsyncAuditDOKUMENTUM
    ON T_DOKUMENTUM
    WITH EXECUTE AS 'Kreta_tech_user'
    FOR INSERT, UPDATE, DELETE
  AS
  BEGIN
    SET NOCOUNT ON; 

    DECLARE @messageBody nvarchar(max)
    DECLARE @TableId int
    DECLARE @alterationTime datetime = GETDATE()

    --get relevant information from inserted/deleted and convert to xml message
    SET @messageBody = (
      SELECT 'T_DOKUMENTUM' AS 'name', GETDATE() AS 'alterationTime', 
        JSON_QUERY (
          (SELECT              
             ID AS 'ID' 
            ,C_INTEZMENYID AS 'C_INTEZMENYID'
            ,C_TANEVID AS 'C_TANEVID'
            ,CREATOR AS 'CREATOR'
            ,MODIFIER AS 'MODIFIER'
            ,C_TARTALOMTIPUS AS 'col.C_TARTALOMTIPUS', C_IKTATOTTDOKUMENTUMID AS 'col.C_IKTATOTTDOKUMENTUMID', TOROLT AS 'col.TOROLT', MODIFIER AS 'col.MODIFIER', CREATOR AS 'col.CREATOR', ELOZOTANEVIREKORDID AS 'col.ELOZOTANEVIREKORDID'
          FROM inserted
          FOR JSON PATH, ROOT('audit'), INCLUDE_NULL_VALUES), '$.audit'
        ) AS 'inserted',
        JSON_QUERY (
          (SELECT              
             ID AS 'ID' 
            ,C_INTEZMENYID AS 'C_INTEZMENYID'
            ,C_TANEVID AS 'C_TANEVID'
            ,CREATOR AS 'CREATOR'
            ,MODIFIER AS 'MODIFIER'
            ,C_TARTALOMTIPUS AS 'col.C_TARTALOMTIPUS', C_IKTATOTTDOKUMENTUMID AS 'col.C_IKTATOTTDOKUMENTUMID', TOROLT AS 'col.TOROLT', MODIFIER AS 'col.MODIFIER', CREATOR AS 'col.CREATOR', ELOZOTANEVIREKORDID AS 'col.ELOZOTANEVIREKORDID'
          FROM deleted
          FOR JSON PATH, ROOT('audit'), INCLUDE_NULL_VALUES), '$.audit'
        ) AS 'deleted'      
      FOR JSON PATH, WITHOUT_ARRAY_WRAPPER, INCLUDE_NULL_VALUES
    )

    IF (@messageBody IS NOT NULL) BEGIN
      BEGIN TRY
    	  EXEC [auditlog].[usp_send] 
    	    @fromService = 'AuditService',
    	    @toService = 'AuditService',
    	    @onContract = 'AuditContract',
    	    @messageType = 'AuditMessage',
    	    @messageBody = @messageBody
        INSERT INTO auditlog.XmlAudit (MessageBody, InsertedAt)
        VALUES (@messageBody, ISNULL(@alterationTime, GETDATE()))
	    END TRY
      BEGIN CATCH
        INSERT INTO auditlog.XmlAudit (MessageBody, InsertedAt)
        VALUES (@messageBody, ISNULL(@alterationTime, GETDATE()))      
      END CATCH
    END
  END
GO
PRINT N'Refreshing [dbo].[T_IKTATOTTDOKUMENTUM_OSSZES]...';


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


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


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


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


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


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


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


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


GO
CREATE VIEW [dbo].T_DOKUMENTUM_OSSZES
        AS
        SELECT *
        FROM dbo.T_DOKUMENTUM
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].[fnGetDokumentumTanulokOsztalybanToltottNapjai]...';


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_IKTATOTTDOKUMENTUM] WITH CHECK CHECK CONSTRAINT [FK_4028569_4028567];

ALTER TABLE [dbo].[T_IKTATOTTDOKUMENTUM] WITH CHECK CHECK CONSTRAINT [FK_402854402_402854400];

ALTER TABLE [dbo].[T_IKTATOTTDOKUMENTUM] WITH CHECK CHECK CONSTRAINT [FK_402854405_402854403];

ALTER TABLE [dbo].[T_IKTATOTTDOKUMENTUM] WITH CHECK CHECK CONSTRAINT [FK_4028544_4028554];

ALTER TABLE [dbo].[T_IKTATOTTDOKUMENTUM] WITH CHECK CHECK CONSTRAINT [FK_4028544_4028555];

ALTER TABLE [dbo].[T_IKTATOTTDOKUMENTUM] WITH CHECK CHECK CONSTRAINT [FK_4028544_4028556];

ALTER TABLE [dbo].[T_DOKUMENTUMKULCSSZO] WITH CHECK CHECK CONSTRAINT [FK_4028563_4028561];

ALTER TABLE [dbo].[T_IKTATOTTDOKUMENTUM] WITH CHECK CHECK CONSTRAINT [FK_4028589_4028587];

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

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

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

ALTER TABLE [dbo].[T_OSZTALYCSOPORT_TANEVRENDJE] WITH CHECK CHECK CONSTRAINT [FK_4025515_4025513];

ALTER TABLE [dbo].[T_TANEVRENDJE] WITH CHECK CHECK CONSTRAINT [FK_4026086_4026085];

ALTER TABLE [dbo].[T_TANEVRENDJE] WITH CHECK CHECK CONSTRAINT [FK_402544102_402544100];

ALTER TABLE [dbo].[T_TANEVRENDJE] WITH CHECK CHECK CONSTRAINT [FK_402544105_402544103];

ALTER TABLE [dbo].[T_TANEVRENDJE] WITH CHECK CHECK CONSTRAINT [FK_4025441_4025444];

ALTER TABLE [dbo].[T_TANEVRENDJE] WITH CHECK CHECK CONSTRAINT [FK_4025441_4025445];

ALTER TABLE [dbo].[T_TANEVRENDJE] WITH CHECK CHECK CONSTRAINT [FK_4025441_4025447];

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

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_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_HAZIFELADATOK] WITH CHECK CHECK CONSTRAINT [FK_4028129_4028127];

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_DOKUMENTUM] WITH CHECK CHECK CONSTRAINT [FK_4028586_4028584];

ALTER TABLE [dbo].[T_DOKUMENTUM] WITH CHECK CHECK CONSTRAINT [FK_402857902_402857900];

ALTER TABLE [dbo].[T_DOKUMENTUM] WITH CHECK CHECK CONSTRAINT [FK_402857905_402857903];


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_IKTATOTTDOKUMENTUM', 'T_IKTATOTTDOKUMENTUM_OSSZES'
					,'T_ORARENDIORA', 'T_ORARENDIORA_OSSZES'
					,'T_TANEVRENDJE', 'T_TANEVRENDJE_OSSZES'
					,'T_TANITASIORA', 'T_TANITASIORA_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


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

GO

