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

SET NUMERIC_ROUNDABORT OFF;


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


GO
CREATE TABLE [dbo].[T_TANULOERTEKELESLATTAMOZAS] (
    [ID]                  INT      IDENTITY (1, 1) NOT NULL,
    [C_LATTAMOZASDATUMA]  DATETIME NULL,
    [C_TANULOERTEKELESID] INT      NULL,
    [C_GONDVISELOID]      INT      NULL,
    [C_TANULOID]          INT      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_4028050] PRIMARY KEY CLUSTERED ([ID] ASC)
);


GO
PRINT N'Creating [dbo].[T_TANULOERTEKELESLATTAMOZAS].[I_T_4028054_4028052]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4028054_4028052]
    ON [dbo].[T_TANULOERTEKELESLATTAMOZAS]([C_TANULOERTEKELESID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOERTEKELESLATTAMOZAS].[I_T_4028060_4028058]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4028060_4028058]
    ON [dbo].[T_TANULOERTEKELESLATTAMOZAS]([C_GONDVISELOID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOERTEKELESLATTAMOZAS].[I_T_4028072_4028070]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4028072_4028070]
    ON [dbo].[T_TANULOERTEKELESLATTAMOZAS]([C_TANULOID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOERTEKELESLATTAMOZAS].[I_T_402805002_402805000]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402805002_402805000]
    ON [dbo].[T_TANULOERTEKELESLATTAMOZAS]([C_INTEZMENYID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOERTEKELESLATTAMOZAS].[I_T_402805005_402805003]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402805005_402805003]
    ON [dbo].[T_TANULOERTEKELESLATTAMOZAS]([C_TANEVID] ASC);


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


GO
CREATE TABLE [dbo].[T_TANULOESEMENYLATTAMOZAS] (
    [ID]                  INT      IDENTITY (1, 1) NOT NULL,
    [C_LATTAMOZASDATUMA]  DATETIME NULL,
    [C_GONDVISELOID]      INT      NULL,
    [C_TANULOID]          INT      NULL,
    [C_TANULOESEMENYID]   INT      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_4028048] PRIMARY KEY CLUSTERED ([ID] ASC)
);


GO
PRINT N'Creating [dbo].[T_TANULOESEMENYLATTAMOZAS].[I_T_4028056_4028055]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4028056_4028055]
    ON [dbo].[T_TANULOESEMENYLATTAMOZAS]([C_GONDVISELOID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOESEMENYLATTAMOZAS].[I_T_4028075_4028073]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4028075_4028073]
    ON [dbo].[T_TANULOESEMENYLATTAMOZAS]([C_TANULOID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOESEMENYLATTAMOZAS].[I_T_4028078_4028076]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4028078_4028076]
    ON [dbo].[T_TANULOESEMENYLATTAMOZAS]([C_TANULOESEMENYID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOESEMENYLATTAMOZAS].[I_T_402804802_402804800]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402804802_402804800]
    ON [dbo].[T_TANULOESEMENYLATTAMOZAS]([C_INTEZMENYID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOESEMENYLATTAMOZAS].[I_T_402804805_402804803]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402804805_402804803]
    ON [dbo].[T_TANULOESEMENYLATTAMOZAS]([C_TANEVID] ASC);


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


GO
CREATE TABLE [dbo].[T_TANULOMULASZTASLATTAMOZAS] (
    [ID]                  INT      IDENTITY (1, 1) NOT NULL,
    [C_LATTAMOZASDATUMA]  DATETIME NULL,
    [C_GONDVISELOID]      INT      NULL,
    [C_TANULOMULASZTASID] INT      NULL,
    [C_TANULOID]          INT      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_4028046] PRIMARY KEY CLUSTERED ([ID] ASC)
);


GO
PRINT N'Creating [dbo].[T_TANULOMULASZTASLATTAMOZAS].[I_T_4028063_4028061]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4028063_4028061]
    ON [dbo].[T_TANULOMULASZTASLATTAMOZAS]([C_GONDVISELOID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOMULASZTASLATTAMOZAS].[I_T_4028066_4028064]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4028066_4028064]
    ON [dbo].[T_TANULOMULASZTASLATTAMOZAS]([C_TANULOMULASZTASID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOMULASZTASLATTAMOZAS].[I_T_4028069_4028067]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4028069_4028067]
    ON [dbo].[T_TANULOMULASZTASLATTAMOZAS]([C_TANULOID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOMULASZTASLATTAMOZAS].[I_T_402804602_402804600]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402804602_402804600]
    ON [dbo].[T_TANULOMULASZTASLATTAMOZAS]([C_INTEZMENYID] ASC);


GO
PRINT N'Creating [dbo].[T_TANULOMULASZTASLATTAMOZAS].[I_T_402804605_402804603]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402804605_402804603]
    ON [dbo].[T_TANULOMULASZTASLATTAMOZAS]([C_TANEVID] ASC);


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_TANULOESEMENYLATTAMOZAS] WITH NOCHECK
    ADD CONSTRAINT [FK_4028056_4028055] FOREIGN KEY ([C_GONDVISELOID]) REFERENCES [dbo].[T_GONDVISELO] ([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_4028078_4028076]...';


GO
ALTER TABLE [dbo].[T_TANULOESEMENYLATTAMOZAS] WITH NOCHECK
    ADD CONSTRAINT [FK_4028078_4028076] FOREIGN KEY ([C_TANULOESEMENYID]) REFERENCES [dbo].[T_TANULOESEMENY] ([ID]);


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


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


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_TANULOMULASZTASLATTAMOZAS] WITH NOCHECK
    ADD CONSTRAINT [FK_4028066_4028064] FOREIGN KEY ([C_TANULOMULASZTASID]) REFERENCES [dbo].[T_TANULOMULASZTAS] ([ID]);


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


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


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


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


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


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


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


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

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

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

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

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

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

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

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

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

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

ALTER TABLE [dbo].[T_TANULOMULASZTASLATTAMOZAS] WITH CHECK CHECK CONSTRAINT [FK_4028063_4028061];

ALTER TABLE [dbo].[T_TANULOMULASZTASLATTAMOZAS] WITH CHECK CHECK CONSTRAINT [FK_4028066_4028064];

ALTER TABLE [dbo].[T_TANULOMULASZTASLATTAMOZAS] WITH CHECK CHECK CONSTRAINT [FK_4028069_4028067];

ALTER TABLE [dbo].[T_TANULOMULASZTASLATTAMOZAS] WITH CHECK CHECK CONSTRAINT [FK_402804602_402804600];

ALTER TABLE [dbo].[T_TANULOMULASZTASLATTAMOZAS] WITH CHECK CHECK CONSTRAINT [FK_402804605_402804603];


GO
PRINT N'Update complete.';


GO
