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


GO
CREATE TABLE [dbo].[T_ELEARNING] (
    [ID]                        INT            IDENTITY (1, 1) NOT NULL,
    [C_BEFEJEZETT]              CHAR (1)       NOT NULL,
    [C_ELEARNINGAZONOSITO]      NVARCHAR (500) NOT NULL,
    [C_ELEARNINGFELHASZNALONEV] NVARCHAR (500) NOT NULL,
    [C_SIKERES]                 CHAR (1)       NOT NULL,
    [C_SZERZODESES]             CHAR (1)       NOT NULL,
    [C_TANANYAGKOD]             NVARCHAR (500) NOT NULL,
    [C_FELHASZNALOID]           INT            NOT NULL,
    [C_INTEZMENYID]             INT            NOT NULL,
    [C_TANEVID]                 INT            NOT NULL,
    [TOROLT]                    CHAR (1)       NOT NULL,
    [SERIAL]                    INT            NOT NULL,
    [LASTCHANGED]               DATETIME       NOT NULL,
    [CREATED]                   DATETIME       NOT NULL,
    [MODIFIER]                  INT            NULL,
    [CREATOR]                   INT            NULL,
    [ELOZOTANEVIREKORDID]       INT            NULL,
    [NNID]                      INT            NULL,
    CONSTRAINT [PK_T_4028098] PRIMARY KEY CLUSTERED ([ID] ASC)
);


GO
PRINT N'Creating [dbo].[T_ELEARNING].[I_T_4028107_4028105]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4028107_4028105]
    ON [dbo].[T_ELEARNING]([C_FELHASZNALOID] ASC);


GO
PRINT N'Creating [dbo].[T_ELEARNING].[I_T_402809802_402809800]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402809802_402809800]
    ON [dbo].[T_ELEARNING]([C_INTEZMENYID] ASC);


GO
PRINT N'Creating [dbo].[T_ELEARNING].[I_T_402809805_402809803]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402809805_402809803]
    ON [dbo].[T_ELEARNING]([C_TANEVID] ASC);


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


GO
ALTER TABLE [dbo].[T_ELEARNING]
    ADD DEFAULT ('F') FOR [C_BEFEJEZETT];


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_ELEARNING]
    ADD DEFAULT ('F') FOR [C_SZERZODESES];


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


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


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


GO
ALTER TABLE [dbo].[T_ELEARNING]
    ADD DEFAULT ('F') FOR [C_SIKERES];


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


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


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


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


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_ELEARNING] WITH CHECK CHECK CONSTRAINT [FK_4028107_4028105];

ALTER TABLE [dbo].[T_ELEARNING] WITH CHECK CHECK CONSTRAINT [FK_402809802_402809800];

ALTER TABLE [dbo].[T_ELEARNING] WITH CHECK CHECK CONSTRAINT [FK_402809805_402809803];


GO
PRINT N'Update complete.';


GO
