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

SET NUMERIC_ROUNDABORT OFF;


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


GO
ALTER TABLE [dbo].[T_FELHASZNALOBELEPES] DROP CONSTRAINT [FK_4025031_4025029];


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


GO
ALTER TABLE [dbo].[T_FELHASZNALOBELEPES] DROP CONSTRAINT [FK_4025187_4025186];


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


GO
ALTER TABLE [dbo].[T_FELHASZNALOBELEPES] DROP CONSTRAINT [FK_402502202_402502200];


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


GO
ALTER TABLE [dbo].[T_FELHASZNALOBELEPES] DROP CONSTRAINT [FK_402502205_402502203];


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


GO
ALTER TABLE [dbo].[T_JELSZOVISSZAALLITAS] DROP CONSTRAINT [FK_4028152_4028151];


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


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


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


GO
ALTER TABLE [dbo].[T_FOGLALKOZAS] DROP CONSTRAINT [FK_4025428_4025426];


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


GO
ALTER TABLE [dbo].[T_FOGLALKOZAS] DROP CONSTRAINT [FK_4025431_4025429];


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


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


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


GO
ALTER TABLE [dbo].[T_FOGLALKOZAS] DROP CONSTRAINT [FK_402542202_402542200];


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


GO
ALTER TABLE [dbo].[T_FOGLALKOZAS] DROP CONSTRAINT [FK_402542205_402542203];


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


GO
ALTER TABLE [dbo].[T_FOGLALKOZAS] DROP CONSTRAINT [FK_4025422_4025423];


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


GO
ALTER TABLE [dbo].[T_TEREM_FOGLALKOZAS] DROP CONSTRAINT [FK_4025949_4025947];


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_TANULOESEMENYLATTAMOZAS] DROP CONSTRAINT [FK_4028075_4028073];


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_ERETTSEGIVALASZ] DROP CONSTRAINT [FK_4028240_4028238];


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


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


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


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


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_OSSZEFUGGOSZAKGYAK] DROP CONSTRAINT [FK_4028375_4028373];


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_OSZTALYCSOPORT] DROP CONSTRAINT [FK_4025954_4025953];


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


GO
ALTER TABLE [dbo].[T_OGTEREMFOGLALTSAG] DROP CONSTRAINT [FK_4027875_4027873];


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


GO
ALTER TABLE [dbo].[T_OGORARENDIORA] DROP CONSTRAINT [FK_4027860_4027858];


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


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


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


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


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


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


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


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


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_TEREM_TANARITANTARGY] DROP CONSTRAINT [FK_4025951_4025950];


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


GO
ALTER TABLE [dbo].[T_TEREM_FOGLALKOZAS] DROP CONSTRAINT [FK_4025948_4025947];


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


GO
ALTER TABLE [dbo].[T_TERMEK_JOGYAKORLATOK] DROP CONSTRAINT [FK_4025913_4025912];


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


GO
ALTER TABLE [dbo].[T_OGFOGLALKOZAS_TEREM] DROP CONSTRAINT [FK_4027801_4027799];


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


GO
ALTER TABLE [dbo].[T_OGTEREM_TANTARGY] DROP CONSTRAINT [FK_4027779_4027778];


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


GO
ALTER TABLE [dbo].[T_FELHASZNALOBELEPES] DROP CONSTRAINT [CK_SoNullValidation];


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


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


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


GO
IF OBJECT_ID('dbo.[fnGuidValidation]') IS NOT NULL
	DROP FUNCTION [dbo].[fnGuidValidation];


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


GO
BEGIN TRANSACTION;

SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;

SET XACT_ABORT ON;

CREATE TABLE [dbo].[tmp_ms_xx_T_FELHASZNALOBELEPES] (
    [ID]                        INT            IDENTITY (1, 1) NOT NULL,
    [C_KOTELEZOVALTOZTATNI]     CHAR (1)       DEFAULT ('T') NULL,
    [C_MEGHIUSULTBELEPESEK]     INT            NULL,
    [C_UTOLSOBELEPES]           DATETIME       NULL,
    [C_JELSZO]                  NVARCHAR (64)  NULL,
    [C_JELSZOVALTOZTATASIDEJE]  DATETIME       NULL,
    [C_SO]                      NVARCHAR (64)  NULL,
    [C_BEJELENTKEZESINEV]       NVARCHAR (255) NOT NULL,
    [C_NEPTUNNAPLOJELSZO]       NVARCHAR (64)  NULL,
    [C_GUID]                    NVARCHAR (36)  NOT NULL,
    [C_ISCSOKKENTETTGONDVISELO] CHAR (1)       DEFAULT ('F') NOT NULL,
    [C_FELHASZNALOID]           INT            NOT NULL,
    [C_GONDVISELOID]            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_40250221] PRIMARY KEY CLUSTERED ([ID] ASC)
);

IF EXISTS (SELECT TOP 1 1 
           FROM   [dbo].[T_FELHASZNALOBELEPES])
    BEGIN
        SET IDENTITY_INSERT [dbo].[tmp_ms_xx_T_FELHASZNALOBELEPES] ON;
        INSERT INTO [dbo].[tmp_ms_xx_T_FELHASZNALOBELEPES] ([ID], [C_KOTELEZOVALTOZTATNI], [C_MEGHIUSULTBELEPESEK], [C_UTOLSOBELEPES], [C_JELSZO], [C_JELSZOVALTOZTATASIDEJE], [C_SO], [C_BEJELENTKEZESINEV], [C_NEPTUNNAPLOJELSZO], [C_GUID], [C_FELHASZNALOID], [C_GONDVISELOID], [C_INTEZMENYID], [C_TANEVID], [TOROLT], [SERIAL], [LASTCHANGED], [CREATED], [MODIFIER], [CREATOR], [ELOZOTANEVIREKORDID], [NNID])
        SELECT   [ID],
                 [C_KOTELEZOVALTOZTATNI],
                 [C_MEGHIUSULTBELEPESEK],
                 [C_UTOLSOBELEPES],
                 [C_JELSZO],
                 [C_JELSZOVALTOZTATASIDEJE],
                 [C_SO],
                 [C_BEJELENTKEZESINEV],
                 [C_NEPTUNNAPLOJELSZO],
                 [C_GUID],
                 [C_FELHASZNALOID],
                 [C_GONDVISELOID],
                 [C_INTEZMENYID],
                 [C_TANEVID],
                 [TOROLT],
                 [SERIAL],
                 [LASTCHANGED],
                 [CREATED],
                 [MODIFIER],
                 [CREATOR],
                 [ELOZOTANEVIREKORDID],
                 [NNID]
        FROM     [dbo].[T_FELHASZNALOBELEPES]
        ORDER BY [ID] ASC;
        SET IDENTITY_INSERT [dbo].[tmp_ms_xx_T_FELHASZNALOBELEPES] OFF;
    END

DROP TABLE [dbo].[T_FELHASZNALOBELEPES];

EXECUTE sp_rename N'[dbo].[tmp_ms_xx_T_FELHASZNALOBELEPES]', N'T_FELHASZNALOBELEPES';

EXECUTE sp_rename N'[dbo].[tmp_ms_xx_constraint_PK_T_40250221]', N'PK_T_4025022', N'OBJECT';

COMMIT TRANSACTION;

SET TRANSACTION ISOLATION LEVEL READ COMMITTED;


GO
PRINT N'Creating [dbo].[T_FELHASZNALOBELEPES].[I_T_4025031_4025029]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025031_4025029]
    ON [dbo].[T_FELHASZNALOBELEPES]([C_FELHASZNALOID] ASC);


GO
PRINT N'Creating [dbo].[T_FELHASZNALOBELEPES].[I_T_4025187_4025186]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025187_4025186]
    ON [dbo].[T_FELHASZNALOBELEPES]([C_GONDVISELOID] ASC);


GO
PRINT N'Creating [dbo].[T_FELHASZNALOBELEPES].[I_T_402502202_402502200]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402502202_402502200]
    ON [dbo].[T_FELHASZNALOBELEPES]([C_INTEZMENYID] ASC);


GO
PRINT N'Creating [dbo].[T_FELHASZNALOBELEPES].[I_T_402502205_402502203]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402502205_402502203]
    ON [dbo].[T_FELHASZNALOBELEPES]([C_TANEVID] ASC);


GO
PRINT N'Creating [dbo].[T_FELHASZNALOBELEPES].[UK_4025364]...';


GO
CREATE UNIQUE NONCLUSTERED INDEX [UK_4025364]
    ON [dbo].[T_FELHASZNALOBELEPES]([C_BEJELENTKEZESINEV] ASC, [C_INTEZMENYID] ASC, [C_TANEVID] ASC) WHERE ([TOROLT]='F');


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


GO
BEGIN TRANSACTION;

SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;

SET XACT_ABORT ON;

CREATE TABLE [dbo].[tmp_ms_xx_T_FOGLALKOZAS] (
    [ID]                  INT             IDENTITY (1, 1) NOT NULL,
    [C_FOGLALKOZASTIPUSA] INT             NOT NULL,
    [C_ORASZAM]           NUMERIC (10, 2) NOT NULL,
    [C_NEV]               NVARCHAR (255)  NULL,
    [C_ERTEKELESKELL]     CHAR (1)        DEFAULT ('F') NULL,
    [C_MULASZTASKELL]     CHAR (1)        DEFAULT ('F') NULL,
    [C_TANARFELVEHETI]    CHAR (1)        DEFAULT ('T') NULL,
    [C_IMPORTALT]         CHAR (1)        DEFAULT ('F') NULL,
    [C_ISOSSZEVONTORA]    CHAR (1)        DEFAULT ('F') NOT NULL,
    [C_TANTARGYID]        INT             NULL,
    [C_OSZTALYCSOPORTID]  INT             NULL,
    [C_TANARID]           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_40254221] PRIMARY KEY CLUSTERED ([ID] ASC)
);

IF EXISTS (SELECT TOP 1 1 
           FROM   [dbo].[T_FOGLALKOZAS])
    BEGIN
        SET IDENTITY_INSERT [dbo].[tmp_ms_xx_T_FOGLALKOZAS] ON;
        INSERT INTO [dbo].[tmp_ms_xx_T_FOGLALKOZAS] ([ID], [C_FOGLALKOZASTIPUSA], [C_ORASZAM], [C_NEV], [C_ERTEKELESKELL], [C_MULASZTASKELL], [C_TANARFELVEHETI], [C_IMPORTALT], [C_TANTARGYID], [C_OSZTALYCSOPORTID], [C_TANARID], [C_INTEZMENYID], [C_TANEVID], [TOROLT], [SERIAL], [LASTCHANGED], [CREATED], [MODIFIER], [CREATOR], [ELOZOTANEVIREKORDID], [NNID])
        SELECT   [ID],
                 [C_FOGLALKOZASTIPUSA],
                 [C_ORASZAM],
                 [C_NEV],
                 [C_ERTEKELESKELL],
                 [C_MULASZTASKELL],
                 [C_TANARFELVEHETI],
                 [C_IMPORTALT],
                 [C_TANTARGYID],
                 [C_OSZTALYCSOPORTID],
                 [C_TANARID],
                 [C_INTEZMENYID],
                 [C_TANEVID],
                 [TOROLT],
                 [SERIAL],
                 [LASTCHANGED],
                 [CREATED],
                 [MODIFIER],
                 [CREATOR],
                 [ELOZOTANEVIREKORDID],
                 [NNID]
        FROM     [dbo].[T_FOGLALKOZAS]
        ORDER BY [ID] ASC;
        SET IDENTITY_INSERT [dbo].[tmp_ms_xx_T_FOGLALKOZAS] OFF;
    END

DROP TABLE [dbo].[T_FOGLALKOZAS];

EXECUTE sp_rename N'[dbo].[tmp_ms_xx_T_FOGLALKOZAS]', N'T_FOGLALKOZAS';

EXECUTE sp_rename N'[dbo].[tmp_ms_xx_constraint_PK_T_40254221]', N'PK_T_4025422', N'OBJECT';

COMMIT TRANSACTION;

SET TRANSACTION ISOLATION LEVEL READ COMMITTED;


GO
PRINT N'Creating [dbo].[T_FOGLALKOZAS].[I_T_4025422_4025423]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025422_4025423]
    ON [dbo].[T_FOGLALKOZAS]([C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_FOGLALKOZASTIPUSA] ASC);


GO
PRINT N'Creating [dbo].[T_FOGLALKOZAS].[I_T_4025428_4025426]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025428_4025426]
    ON [dbo].[T_FOGLALKOZAS]([C_TANTARGYID] ASC);


GO
PRINT N'Creating [dbo].[T_FOGLALKOZAS].[I_T_4025431_4025429]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025431_4025429]
    ON [dbo].[T_FOGLALKOZAS]([C_OSZTALYCSOPORTID] ASC);


GO
PRINT N'Creating [dbo].[T_FOGLALKOZAS].[I_T_4025437_4025435]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025437_4025435]
    ON [dbo].[T_FOGLALKOZAS]([C_TANARID] ASC);


GO
PRINT N'Creating [dbo].[T_FOGLALKOZAS].[I_T_402542202_402542200]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402542202_402542200]
    ON [dbo].[T_FOGLALKOZAS]([C_INTEZMENYID] ASC);


GO
PRINT N'Creating [dbo].[T_FOGLALKOZAS].[I_T_402542205_402542203]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402542205_402542203]
    ON [dbo].[T_FOGLALKOZAS]([C_TANEVID] ASC);


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


GO
BEGIN TRANSACTION;

SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;

SET XACT_ABORT ON;

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

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

DROP TABLE [dbo].[T_OSZTALY];

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

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

COMMIT TRANSACTION;

SET TRANSACTION ISOLATION LEVEL READ COMMITTED;


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


GO
BEGIN TRANSACTION;

SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;

SET XACT_ABORT ON;

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

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

DROP TABLE [dbo].[T_TANULO];

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

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

COMMIT TRANSACTION;

SET TRANSACTION ISOLATION LEVEL READ COMMITTED;


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


GO
BEGIN TRANSACTION;

SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;

SET XACT_ABORT ON;

CREATE TABLE [dbo].[tmp_ms_xx_T_TEREM] (
    [ID]                     INT            IDENTITY (1, 1) NOT NULL,
    [C_AKTIV]                CHAR (1)       DEFAULT ('T') NULL,
    [C_JELLEG]               INT            NOT NULL,
    [C_KAPACITAS]            INT            NULL,
    [C_NEV]                  NVARCHAR (255) NOT NULL,
    [C_TERULET]              INT            NULL,
    [C_TOBBORATLEHETTARTANI] CHAR (1)       DEFAULT ('F') NULL,
    [C_VIZSGAKAPACITAS]      INT            NULL,
    [C_WIFILEFEDETT]         CHAR (1)       DEFAULT ('F') NULL,
    [C_IMPORTALT]            CHAR (1)       DEFAULT ('F') NOT NULL,
    [C_MUKODESIHELYID]       INT            NOT NULL,
    [C_TEREMFELELOSID]       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_40251221] PRIMARY KEY CLUSTERED ([ID] ASC)
);

IF EXISTS (SELECT TOP 1 1 
           FROM   [dbo].[T_TEREM])
    BEGIN
        SET IDENTITY_INSERT [dbo].[tmp_ms_xx_T_TEREM] ON;
        INSERT INTO [dbo].[tmp_ms_xx_T_TEREM] ([ID], [C_AKTIV], [C_JELLEG], [C_KAPACITAS], [C_NEV], [C_TERULET], [C_TOBBORATLEHETTARTANI], [C_VIZSGAKAPACITAS], [C_WIFILEFEDETT], [C_MUKODESIHELYID], [C_TEREMFELELOSID], [C_INTEZMENYID], [C_TANEVID], [TOROLT], [SERIAL], [LASTCHANGED], [CREATED], [MODIFIER], [CREATOR], [ELOZOTANEVIREKORDID], [NNID])
        SELECT   [ID],
                 [C_AKTIV],
                 [C_JELLEG],
                 [C_KAPACITAS],
                 [C_NEV],
                 [C_TERULET],
                 [C_TOBBORATLEHETTARTANI],
                 [C_VIZSGAKAPACITAS],
                 [C_WIFILEFEDETT],
                 [C_MUKODESIHELYID],
                 [C_TEREMFELELOSID],
                 [C_INTEZMENYID],
                 [C_TANEVID],
                 [TOROLT],
                 [SERIAL],
                 [LASTCHANGED],
                 [CREATED],
                 [MODIFIER],
                 [CREATOR],
                 [ELOZOTANEVIREKORDID],
                 [NNID]
        FROM     [dbo].[T_TEREM]
        ORDER BY [ID] ASC;
        SET IDENTITY_INSERT [dbo].[tmp_ms_xx_T_TEREM] OFF;
    END

DROP TABLE [dbo].[T_TEREM];

EXECUTE sp_rename N'[dbo].[tmp_ms_xx_T_TEREM]', N'T_TEREM';

EXECUTE sp_rename N'[dbo].[tmp_ms_xx_constraint_PK_T_40251221]', N'PK_T_4025122', N'OBJECT';

COMMIT TRANSACTION;

SET TRANSACTION ISOLATION LEVEL READ COMMITTED;


GO
PRINT N'Creating [dbo].[T_TEREM].[I_T_4025122_4025124]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025122_4025124]
    ON [dbo].[T_TEREM]([C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_JELLEG] ASC);


GO
PRINT N'Creating [dbo].[T_TEREM].[I_T_4025412_4025410]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4025412_4025410]
    ON [dbo].[T_TEREM]([C_MUKODESIHELYID] ASC);


GO
PRINT N'Creating [dbo].[T_TEREM].[I_T_4026131_4026130]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4026131_4026130]
    ON [dbo].[T_TEREM]([C_TEREMFELELOSID] ASC);


GO
PRINT N'Creating [dbo].[T_TEREM].[I_T_402512202_402512200]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402512202_402512200]
    ON [dbo].[T_TEREM]([C_INTEZMENYID] ASC);


GO
PRINT N'Creating [dbo].[T_TEREM].[I_T_402512205_402512203]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402512205_402512203]
    ON [dbo].[T_TEREM]([C_TANEVID] ASC);


GO
PRINT N'Creating [dbo].[T_TEREM].[UK_TEREMNEV]...';


GO
CREATE UNIQUE NONCLUSTERED INDEX [UK_TEREMNEV]
    ON [dbo].[T_TEREM]([C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_NEV] ASC, [C_MUKODESIHELYID] ASC) WHERE ([TOROLT]='F');


GO
PRINT N'Creating [dbo].[T_TEREM].[IX_TEREM_INTEZMENYID_ID]...';


GO
CREATE NONCLUSTERED INDEX [IX_TEREM_INTEZMENYID_ID]
    ON [dbo].[T_TEREM]([C_INTEZMENYID] ASC, [ID] ASC)
    INCLUDE([C_NEV], [C_TANEVID]);


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


GO
ALTER TABLE [dbo].[T_FELHASZNALOBELEPES] WITH NOCHECK
    ADD CONSTRAINT [FK_4025031_4025029] FOREIGN KEY ([C_FELHASZNALOID]) REFERENCES [dbo].[T_FELHASZNALO] ([ID]);


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


GO
ALTER TABLE [dbo].[T_FELHASZNALOBELEPES] WITH NOCHECK
    ADD CONSTRAINT [FK_4025187_4025186] FOREIGN KEY ([C_GONDVISELOID]) REFERENCES [dbo].[T_GONDVISELO] ([ID]);


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_JELSZOVISSZAALLITAS] WITH NOCHECK
    ADD CONSTRAINT [FK_4028152_4028151] FOREIGN KEY ([C_FELHASZNALOBELEPESID]) REFERENCES [dbo].[T_FELHASZNALOBELEPES] ([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_4026077_4026075]...';


GO
ALTER TABLE [dbo].[T_TANULOTARGYMULASZTASSTATISZT] WITH NOCHECK
    ADD CONSTRAINT [FK_4026077_4026075] FOREIGN KEY ([C_TARGYMULASZTASSTATISZTIKAIID]) REFERENCES [dbo].[T_FOGLALKOZAS] ([ID]);


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


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


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


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


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


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


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_FOGLALKOZAS] WITH NOCHECK
    ADD CONSTRAINT [FK_4025422_4025423] FOREIGN KEY ([C_FOGLALKOZASTIPUSA], [C_INTEZMENYID], [C_TANEVID]) REFERENCES [dbo].[T_FOGLALKOZASTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


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


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


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_OSZTALY] WITH NOCHECK
    ADD CONSTRAINT [FK_T_4025296_4025338] FOREIGN KEY ([ID]) REFERENCES [dbo].[T_OSZTALYCSOPORT] ([ID]);


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_TANULO] WITH NOCHECK
    ADD CONSTRAINT [FK_4025178_4028486] FOREIGN KEY ([C_TANULOEVFOLYAMTIPUS], [C_ALINTEZMENYID], [C_ALTANEVID]) REFERENCES [dbo].[T_EVFOLYAMTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


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


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


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_TEREM] WITH NOCHECK
    ADD CONSTRAINT [FK_4025122_4025124] FOREIGN KEY ([C_JELLEG], [C_INTEZMENYID], [C_TANEVID]) REFERENCES [dbo].[T_TEREMTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


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


GO
ALTER TABLE [dbo].[T_TEREM] WITH NOCHECK
    ADD CONSTRAINT [FK_4025412_4025410] FOREIGN KEY ([C_MUKODESIHELYID]) REFERENCES [dbo].[T_MUKODESIHELY] ([ID]);


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


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


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_ESZKOZ] WITH NOCHECK
    ADD CONSTRAINT [FK_4025130_4025128] FOREIGN KEY ([C_TEREMID]) REFERENCES [dbo].[T_TEREM] ([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_4025951_4025950]...';


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


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


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


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


GO
ALTER TABLE [dbo].[T_TERMEK_JOGYAKORLATOK] WITH NOCHECK
    ADD CONSTRAINT [FK_4025913_4025912] FOREIGN KEY ([C_TERMEKID]) REFERENCES [dbo].[T_TEREM] ([ID]);


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_FELHASZNALOBELEPES] WITH NOCHECK
    ADD CONSTRAINT [CK_C_GUID] CHECK ([C_GUID]<>N'');


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


GO
ALTER TABLE [dbo].[T_FELHASZNALOBELEPES] WITH NOCHECK
    ADD CONSTRAINT [CK_FELHASZNALOBELEPES_PasswordValidation] CHECK (NOT ([C_JELSZO] IS NOT NULL AND len([C_JELSZO])<>(28) AND NOT [C_JELSZO] like '%='));


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


GO
ALTER TABLE [dbo].[T_FELHASZNALOBELEPES] WITH NOCHECK
    ADD CONSTRAINT [CK_SoNullValidation] CHECK (NOT ([C_JELSZO] IS NOT NULL AND [C_SO] IS NULL AND [C_NEPTUNNAPLOJELSZO] IS NULL));


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


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


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


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


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


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


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


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


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


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


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


GO
CREATE FUNCTION dbo.fnGuidValidation (
     @loginName nvarchar(36)
    ,@intezmenyId int
) RETURNS int
BEGIN
  RETURN (
    SELECT COUNT(DISTINCT C_GUID)
    FROM [dbo].[T_FELHASZNALOBELEPES]
    WHERE C_BEJELENTKEZESINEV = @loginName
      AND C_INTEZMENYID = @intezmenyId
      AND TOROLT='F'
  )
END;
GO
PRINT N'Creating [dbo].[CK_FELHASZNALOBELEPES_GuidValidation]...';


GO
ALTER TABLE [dbo].[T_FELHASZNALOBELEPES] WITH NOCHECK
    ADD CONSTRAINT [CK_FELHASZNALOBELEPES_GuidValidation] CHECK ([dbo].[fnGuidValidation]([C_BEJELENTKEZESINEV],[C_INTEZMENYID])<=(1));


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_FELHASZNALOBELEPES] WITH CHECK CHECK CONSTRAINT [FK_4025031_4025029];

ALTER TABLE [dbo].[T_FELHASZNALOBELEPES] WITH CHECK CHECK CONSTRAINT [FK_4025187_4025186];

ALTER TABLE [dbo].[T_FELHASZNALOBELEPES] WITH CHECK CHECK CONSTRAINT [FK_402502202_402502200];

ALTER TABLE [dbo].[T_FELHASZNALOBELEPES] WITH CHECK CHECK CONSTRAINT [FK_402502205_402502203];

ALTER TABLE [dbo].[T_JELSZOVISSZAALLITAS] WITH CHECK CHECK CONSTRAINT [FK_4028152_4028151];

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

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

ALTER TABLE [dbo].[T_FOGLALKOZAS] WITH CHECK CHECK CONSTRAINT [FK_4025428_4025426];

ALTER TABLE [dbo].[T_FOGLALKOZAS] WITH CHECK CHECK CONSTRAINT [FK_4025431_4025429];

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

ALTER TABLE [dbo].[T_FOGLALKOZAS] WITH CHECK CHECK CONSTRAINT [FK_402542202_402542200];

ALTER TABLE [dbo].[T_FOGLALKOZAS] WITH CHECK CHECK CONSTRAINT [FK_402542205_402542203];

ALTER TABLE [dbo].[T_FOGLALKOZAS] WITH CHECK CHECK CONSTRAINT [FK_4025422_4025423];

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

ALTER TABLE [dbo].[T_TEREM_FOGLALKOZAS] WITH CHECK CHECK CONSTRAINT [FK_4025949_4025947];

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

ALTER TABLE [dbo].[T_TANULOESEMENYLATTAMOZAS] WITH CHECK CHECK CONSTRAINT [FK_4028075_4028073];

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

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

ALTER TABLE [dbo].[T_ERETTSEGIVALASZ] WITH CHECK CHECK CONSTRAINT [FK_4028240_4028238];

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

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

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

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

ALTER TABLE [dbo].[T_OSSZEFUGGOSZAKGYAK] WITH CHECK CHECK CONSTRAINT [FK_4028375_4028373];

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

ALTER TABLE [dbo].[T_OSZTALYCSOPORT] WITH CHECK CHECK CONSTRAINT [FK_4025954_4025953];

ALTER TABLE [dbo].[T_OGTEREMFOGLALTSAG] WITH CHECK CHECK CONSTRAINT [FK_4027875_4027873];

ALTER TABLE [dbo].[T_OGORARENDIORA] WITH CHECK CHECK CONSTRAINT [FK_4027860_4027858];

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

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

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

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

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

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

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

ALTER TABLE [dbo].[T_TEREM_TANARITANTARGY] WITH CHECK CHECK CONSTRAINT [FK_4025951_4025950];

ALTER TABLE [dbo].[T_TEREM_FOGLALKOZAS] WITH CHECK CHECK CONSTRAINT [FK_4025948_4025947];

ALTER TABLE [dbo].[T_TERMEK_JOGYAKORLATOK] WITH CHECK CHECK CONSTRAINT [FK_4025913_4025912];

ALTER TABLE [dbo].[T_OGFOGLALKOZAS_TEREM] WITH CHECK CHECK CONSTRAINT [FK_4027801_4027799];

ALTER TABLE [dbo].[T_OGTEREM_TANTARGY] WITH CHECK CHECK CONSTRAINT [FK_4027779_4027778];

ALTER TABLE [dbo].[T_FELHASZNALOBELEPES] WITH CHECK CHECK CONSTRAINT [CK_C_GUID];

ALTER TABLE [dbo].[T_FELHASZNALOBELEPES] WITH CHECK CHECK CONSTRAINT [CK_FELHASZNALOBELEPES_PasswordValidation];

ALTER TABLE [dbo].[T_FELHASZNALOBELEPES] WITH CHECK CHECK CONSTRAINT [CK_SoNullValidation];

ALTER TABLE [dbo].[T_FELHASZNALOBELEPES] WITH CHECK CHECK CONSTRAINT [CK_FELHASZNALOBELEPES_GuidValidation];


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_OSZTALY', 'T_OSZTALY_OSSZES'
					,'T_TEREM', 'T_TEREM_OSSZES'
					,'T_TANULO', 'T_TANULO_OSSZES'
					,'T_FOGLALKOZAS', 'T_FOGLALKOZAS_OSSZES'
					,'T_FELHASZNALOBELEPES', 'T_FELHASZNALOBELEPES_OSSZES') -- ha csak néhány VIEW frissült, akkor a gyorsabb futásért ide fel lehet sorolni
  ORDER BY TABLE_SCHEMA, TABLE_NAME

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

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

    FETCH NEXT FROM semaviewk INTO @viewname, @pureview
END             

CLOSE semaviewk
DEALLOCATE semaviewk
GO


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


EXEC dev.sp_Global_GenerateAsyncAuditTriggerAll
GO

EXEC dev.sp_Global_GenerateAsyncAuditProcedureAll
GO

EXEC dev.sp_Global_GenerateAsyncAuditAuditPocessing
GO

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

GO