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


GO
CREATE TABLE [dbo].[T_DOKUMENTUMKATEGORIA] (
    [ID]                   INT      NOT NULL,
    [C_ALINTEZMENYID]      INT      NOT NULL,
    [C_ALTANEVID]          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,
    [ELOZOTANEVIREKORDIDA] INT      NULL,
    [NNID]                 INT      NULL,
    CONSTRAINT [PK_T_4028537] PRIMARY KEY CLUSTERED ([ID] ASC, [C_ALINTEZMENYID] ASC, [C_ALTANEVID] ASC)
);


GO
PRINT N'Creating [dbo].[T_DOKUMENTUMKATEGORIA].[I_T_402853702_402853700]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402853702_402853700]
    ON [dbo].[T_DOKUMENTUMKATEGORIA]([C_ALINTEZMENYID] ASC);


GO
PRINT N'Creating [dbo].[T_DOKUMENTUMKATEGORIA].[I_T_402853705_402853703]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402853705_402853703]
    ON [dbo].[T_DOKUMENTUMKATEGORIA]([C_ALTANEVID] ASC);


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


GO
CREATE TABLE [dbo].[T_DOKUMENTUMKULCSSZO] (
    [ID]                          INT      IDENTITY (1, 1) NOT NULL,
    [C_DOKUMENTUMKULCSSZOTIPUS]   INT      NOT NULL,
    [C_IKTATOTTDOKUMENTUMID]      INT      NOT NULL,
    [C_DOKUMENTUMKULCSSZOERTEKID] 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_4028542] PRIMARY KEY CLUSTERED ([ID] ASC)
);


GO
PRINT N'Creating [dbo].[T_DOKUMENTUMKULCSSZO].[I_T_4028542_4028543]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4028542_4028543]
    ON [dbo].[T_DOKUMENTUMKULCSSZO]([C_INTEZMENYID] ASC, [C_TANEVID] ASC, [C_DOKUMENTUMKULCSSZOTIPUS] ASC);


GO
PRINT N'Creating [dbo].[T_DOKUMENTUMKULCSSZO].[I_T_4028563_4028561]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4028563_4028561]
    ON [dbo].[T_DOKUMENTUMKULCSSZO]([C_IKTATOTTDOKUMENTUMID] ASC);


GO
PRINT N'Creating [dbo].[T_DOKUMENTUMKULCSSZO].[I_T_4028566_4028564]...';


GO
CREATE NONCLUSTERED INDEX [I_T_4028566_4028564]
    ON [dbo].[T_DOKUMENTUMKULCSSZO]([C_DOKUMENTUMKULCSSZOERTEKID] ASC);


GO
PRINT N'Creating [dbo].[T_DOKUMENTUMKULCSSZO].[I_T_402854202_402854200]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402854202_402854200]
    ON [dbo].[T_DOKUMENTUMKULCSSZO]([C_INTEZMENYID] ASC);


GO
PRINT N'Creating [dbo].[T_DOKUMENTUMKULCSSZO].[I_T_402854205_402854203]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402854205_402854203]
    ON [dbo].[T_DOKUMENTUMKULCSSZO]([C_TANEVID] ASC);


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


GO
CREATE TABLE [dbo].[T_DOKUMENTUMKULCSSZOERTEK] (
    [ID]                  INT            IDENTITY (1, 1) NOT NULL,
    [C_ERTEK]             NVARCHAR (256) NOT NULL,
    [C_ENTITYID]          INT            NULL,
    [C_ENTITYNAME]        NVARCHAR (50)  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_4028557] PRIMARY KEY CLUSTERED ([ID] ASC)
);


GO
PRINT N'Creating [dbo].[T_DOKUMENTUMKULCSSZOERTEK].[I_T_402855702_402855700]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402855702_402855700]
    ON [dbo].[T_DOKUMENTUMKULCSSZOERTEK]([C_INTEZMENYID] ASC);


GO
PRINT N'Creating [dbo].[T_DOKUMENTUMKULCSSZOERTEK].[I_T_402855705_402855703]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402855705_402855703]
    ON [dbo].[T_DOKUMENTUMKULCSSZOERTEK]([C_TANEVID] ASC);


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


GO
CREATE TABLE [dbo].[T_DOKUMENTUMKULCSSZOTIPUS] (
    [ID]                       INT           NOT NULL,
    [C_POSZEIDONKULCSSZOTIPUS] NVARCHAR (64) NULL,
    [C_ALINTEZMENYID]          INT           NOT NULL,
    [C_ALTANEVID]              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,
    [ELOZOTANEVIREKORDIDA]     INT           NULL,
    [NNID]                     INT           NULL,
    CONSTRAINT [PK_T_4028538] PRIMARY KEY CLUSTERED ([ID] ASC, [C_ALINTEZMENYID] ASC, [C_ALTANEVID] ASC)
);


GO
PRINT N'Creating [dbo].[T_DOKUMENTUMKULCSSZOTIPUS].[I_T_402853802_402853800]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402853802_402853800]
    ON [dbo].[T_DOKUMENTUMKULCSSZOTIPUS]([C_ALINTEZMENYID] ASC);


GO
PRINT N'Creating [dbo].[T_DOKUMENTUMKULCSSZOTIPUS].[I_T_402853805_402853803]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402853805_402853803]
    ON [dbo].[T_DOKUMENTUMKULCSSZOTIPUS]([C_ALTANEVID] ASC);


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


GO
CREATE TABLE [dbo].[T_DOKUMENTUMSTATUSZ] (
    [ID]                   INT      NOT NULL,
    [C_ALINTEZMENYID]      INT      NOT NULL,
    [C_ALTANEVID]          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,
    [ELOZOTANEVIREKORDIDA] INT      NULL,
    [NNID]                 INT      NULL,
    CONSTRAINT [PK_T_4028540] PRIMARY KEY CLUSTERED ([ID] ASC, [C_ALINTEZMENYID] ASC, [C_ALTANEVID] ASC)
);


GO
PRINT N'Creating [dbo].[T_DOKUMENTUMSTATUSZ].[I_T_402854002_402854000]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402854002_402854000]
    ON [dbo].[T_DOKUMENTUMSTATUSZ]([C_ALINTEZMENYID] ASC);


GO
PRINT N'Creating [dbo].[T_DOKUMENTUMSTATUSZ].[I_T_402854005_402854003]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402854005_402854003]
    ON [dbo].[T_DOKUMENTUMSTATUSZ]([C_ALTANEVID] ASC);


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


GO
CREATE TABLE [dbo].[T_DOKUMENTUMTIPUS] (
    [ID]                   INT      NOT NULL,
    [C_ALINTEZMENYID]      INT      NOT NULL,
    [C_ALTANEVID]          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,
    [ELOZOTANEVIREKORDIDA] INT      NULL,
    [NNID]                 INT      NULL,
    CONSTRAINT [PK_T_4028541] PRIMARY KEY CLUSTERED ([ID] ASC, [C_ALINTEZMENYID] ASC, [C_ALTANEVID] ASC)
);


GO
PRINT N'Creating [dbo].[T_DOKUMENTUMTIPUS].[I_T_402854102_402854100]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402854102_402854100]
    ON [dbo].[T_DOKUMENTUMTIPUS]([C_ALINTEZMENYID] ASC);


GO
PRINT N'Creating [dbo].[T_DOKUMENTUMTIPUS].[I_T_402854105_402854103]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402854105_402854103]
    ON [dbo].[T_DOKUMENTUMTIPUS]([C_ALTANEVID] ASC);


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


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


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


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


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


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


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


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


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


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


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


GO
CREATE NONCLUSTERED INDEX [I_T_4028572_4028570]
    ON [dbo].[T_IKTATOTTDOKUMENTUM]([C_ALKALMAZOTTID] ASC);


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


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


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


GO
CREATE NONCLUSTERED INDEX [I_T_402854405_402854403]
    ON [dbo].[T_IKTATOTTDOKUMENTUM]([C_TANEVID] ASC);


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_DOKUMENTUMKULCSSZO] WITH NOCHECK
    ADD CONSTRAINT [FK_4028566_4028564] FOREIGN KEY ([C_DOKUMENTUMKULCSSZOERTEKID]) REFERENCES [dbo].[T_DOKUMENTUMKULCSSZOERTEK] ([ID]);


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_DOKUMENTUMKULCSSZO] WITH NOCHECK
    ADD CONSTRAINT [FK_4028542_4028543] FOREIGN KEY ([C_DOKUMENTUMKULCSSZOTIPUS], [C_INTEZMENYID], [C_TANEVID]) REFERENCES [dbo].[T_DOKUMENTUMKULCSSZOTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_DOKUMENTUMKULCSSZOTIPUS] WITH NOCHECK
    ADD CONSTRAINT [FK_T_21038_4028574] FOREIGN KEY ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]) REFERENCES [dbo].[T_DICTIONARYITEMBASE] ([ID], [C_INTEZMENYID], [C_TANEVID]);


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_IKTATOTTDOKUMENTUM] WITH NOCHECK
    ADD CONSTRAINT [FK_4028572_4028570] FOREIGN KEY ([C_ALKALMAZOTTID]) REFERENCES [dbo].[T_ALKALMAZOTT] ([ID]);


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


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


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


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


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


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_DOKUMENTUMKATEGORIA] WITH CHECK CHECK CONSTRAINT [FK_T_21038_4028573];

ALTER TABLE [dbo].[T_DOKUMENTUMKATEGORIA] WITH CHECK CHECK CONSTRAINT [FK_402853702_402853700];

ALTER TABLE [dbo].[T_DOKUMENTUMKATEGORIA] WITH CHECK CHECK CONSTRAINT [FK_402853705_402853703];

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

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

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

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

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

ALTER TABLE [dbo].[T_DOKUMENTUMKULCSSZOERTEK] WITH CHECK CHECK CONSTRAINT [FK_402855702_402855700];

ALTER TABLE [dbo].[T_DOKUMENTUMKULCSSZOERTEK] WITH CHECK CHECK CONSTRAINT [FK_402855705_402855703];

ALTER TABLE [dbo].[T_DOKUMENTUMKULCSSZOTIPUS] WITH CHECK CHECK CONSTRAINT [FK_T_21038_4028574];

ALTER TABLE [dbo].[T_DOKUMENTUMKULCSSZOTIPUS] WITH CHECK CHECK CONSTRAINT [FK_402853802_402853800];

ALTER TABLE [dbo].[T_DOKUMENTUMKULCSSZOTIPUS] WITH CHECK CHECK CONSTRAINT [FK_402853805_402853803];

ALTER TABLE [dbo].[T_DOKUMENTUMSTATUSZ] WITH CHECK CHECK CONSTRAINT [FK_T_21038_4028575];

ALTER TABLE [dbo].[T_DOKUMENTUMSTATUSZ] WITH CHECK CHECK CONSTRAINT [FK_402854002_402854000];

ALTER TABLE [dbo].[T_DOKUMENTUMSTATUSZ] WITH CHECK CHECK CONSTRAINT [FK_402854005_402854003];

ALTER TABLE [dbo].[T_DOKUMENTUMTIPUS] WITH CHECK CHECK CONSTRAINT [FK_T_21038_4028576];

ALTER TABLE [dbo].[T_DOKUMENTUMTIPUS] WITH CHECK CHECK CONSTRAINT [FK_402854102_402854100];

ALTER TABLE [dbo].[T_DOKUMENTUMTIPUS] WITH CHECK CHECK CONSTRAINT [FK_402854105_402854103];

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

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

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

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

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

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

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


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


GO
CREATE VIEW [dbo].T_DOKUMENTUMKATEGORIA_OSSZES
        AS
        SELECT *
        FROM dbo.T_DOKUMENTUMKATEGORIA
GO
PRINT N'Creating [dbo].[T_DOKUMENTUMKULCSSZO_OSSZES]...';


GO
CREATE VIEW [dbo].T_DOKUMENTUMKULCSSZO_OSSZES
        AS
        SELECT *
        FROM dbo.T_DOKUMENTUMKULCSSZO
GO
PRINT N'Creating [dbo].[T_DOKUMENTUMKULCSSZOERTEK_OSSZES]...';


GO
CREATE VIEW [dbo].T_DOKUMENTUMKULCSSZOERTEK_OSSZES
        AS
        SELECT *
        FROM dbo.T_DOKUMENTUMKULCSSZOERTEK
GO
PRINT N'Creating [dbo].[T_DOKUMENTUMKULCSSZOTIPUS_OSSZES]...';


GO
CREATE VIEW [dbo].T_DOKUMENTUMKULCSSZOTIPUS_OSSZES
        AS
        SELECT *
        FROM dbo.T_DOKUMENTUMKULCSSZOTIPUS
GO
PRINT N'Creating [dbo].[T_DOKUMENTUMSTATUSZ_OSSZES]...';


GO
CREATE VIEW [dbo].T_DOKUMENTUMSTATUSZ_OSSZES
        AS
        SELECT *
        FROM dbo.T_DOKUMENTUMSTATUSZ
GO
PRINT N'Creating [dbo].[T_DOKUMENTUMTIPUS_OSSZES]...';


GO
CREATE VIEW [dbo].T_DOKUMENTUMTIPUS_OSSZES
        AS
        SELECT *
        FROM dbo.T_DOKUMENTUMTIPUS
GO
PRINT N'Creating [dbo].[T_IKTATOTTDOKUMENTUM_OSSZES]...';


GO
CREATE VIEW [dbo].T_IKTATOTTDOKUMENTUM_OSSZES
        AS
        SELECT *
        FROM dbo.T_IKTATOTTDOKUMENTUM
GO

PRINT N'Update complete.';


GO
--------------------


EXEC dev.sp_Global_GenerateAsyncAuditTriggerAll
GO


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

GO

