
    create table COPARAGRP (
        [UUID] uniqueidentifier not null,
        [CONFIG_ID] uniqueidentifier,
        [CREATED_ON] datetime2,
        [MODIFIED_ON] datetime2,
        [RWDU] numeric(5,0),
        [CREATED_BY] varchar(20),
        [MODIFIED_BY] varchar(20),
        [OWN_LIC] varchar(4),
        [OPC] varchar(8),
        [OWNER] numeric(5,0),
        [GROUP] numeric(5,0),
        [ANY] numeric(5,0),
        [STATUS] numeric(5,0),
        [TRANSFERRED_ON] varchar(80),
        [PR_ID] varchar(18),
        [YEAR] numeric(10,0),
        [COST_TYPE_GROUP_ID] varchar(20),
        [COST_TYPE_GROUP] varchar(20),
        [CTG_NAME] varchar(80),
        [COST_OBLIGO] float,
        [CTG_TYPE_CODE] varchar(2),
        [CTG_TYPE_NAME] varchar(40),
        [BUDGET_PROJ_COST] float,
        [BUDGET_SUBMITTED_COST] float,
        [BUDGET_APPROVED_COST] float,
        [BASELINE_COST_THIS] float,
        [BUDGET_PROJ_EFF] float,
        [BUDGET_SUBMITTED_EFF] float,
        [BUDGET_APPROVED_EFF] float,
        [COST_PLANNED_THIS] float,
        [COST_ACT_THIS] float,
        [COST_REM_THIS] float,
        [COST_TOTAL_THIS] float,
        [EFFORT_PLANNED_THIS] float,
        [EFFORT_ACT_THIS] float,
        [EFFORT_REM_THIS] float,
        [EFFORT_TOTAL_THIS] float,
        [OBLIGO_IMPORT] numeric(5,0),
        [CREATION_DATE] datetime2
    );

    IF NOT EXISTS (SELECT * FROM SYS.INDEXES
       WHERE IS_PRIMARY_KEY = 1 AND OBJECT_ID IN
             (SELECT OBJECT_ID FROM SYS.TABLES WHERE NAME = 'COPARAGRP'))
       alter table COPARAGRP add constraint PID559DT559 primary key ([UUID]);

    alter table COPARAGRP with nocheck
        add constraint FKCOPARAGRPID560
        foreign key ([CONFIG_ID])
        references INTERFACE_CONFIG
        on delete no action;

    CREATE TRIGGER UFKCOPARAGRPID560 ON INTERFACE_CONFIG
        FOR DELETE
        AS
        BEGIN
            DELETE t
            FROM DELETED d
                INNER JOIN COPARAGRP t ON d.UUID = t.CONFIG_ID
        END;

    alter table COPARAGRP with check check constraint FKCOPARAGRPID560;

    create index IDX_COPARAGRPID560 on COPARAGRP ([CONFIG_ID]);

    alter table COPARAGRP
        add constraint DT559UUID_DEFAULT DEFAULT newid() FOR [UUID];

    alter table COPARAGRP
        add constraint DT559UUID_NOT_NULL check([UUID] is not null);

    alter table COPARAGRP
        add constraint DT559CONFIG_ID_NOT_NULL check([CONFIG_ID] is not null);

    alter table COPARAGRP
        add constraint DT559DI064825_DEFAULT DEFAULT CONVERT(datetime2,'01.01.1970',104) FOR [CREATED_ON];

    alter table COPARAGRP
        add constraint DT559DI064824_DEFAULT DEFAULT CONVERT(datetime2,'01.01.1970',104) FOR [MODIFIED_ON];

    alter table COPARAGRP
        add constraint DT559DI064823_DEFAULT DEFAULT 0 FOR [RWDU];

    alter table COPARAGRP
        add constraint DT559DI064818_DEFAULT DEFAULT 0 FOR [OWNER];

    alter table COPARAGRP
        add constraint DT559DI064817_DEFAULT DEFAULT 0 FOR [GROUP];

    alter table COPARAGRP
        add constraint DT559DI064816_DEFAULT DEFAULT 0 FOR [ANY];

    alter table COPARAGRP
        add constraint DT559DI064815_DEFAULT DEFAULT 0 FOR [STATUS];

    alter table COPARAGRP
        add constraint DT559DI064901_DEFAULT DEFAULT 0 FOR [YEAR];

    alter table COPARAGRP
        add constraint DT559DI064903_DEFAULT DEFAULT 0 FOR [COST_OBLIGO];

    alter table COPARAGRP
        add constraint DT559DI064918_DEFAULT DEFAULT 0 FOR [BUDGET_PROJ_COST];

    alter table COPARAGRP
        add constraint DT559DI064917_DEFAULT DEFAULT 0 FOR [BUDGET_SUBMITTED_COST];

    alter table COPARAGRP
        add constraint DT559DI064916_DEFAULT DEFAULT 0 FOR [BUDGET_APPROVED_COST];

    alter table COPARAGRP
        add constraint DT559DI064915_DEFAULT DEFAULT 0 FOR [BASELINE_COST_THIS];

    alter table COPARAGRP
        add constraint DT559DI064914_DEFAULT DEFAULT 0 FOR [BUDGET_PROJ_EFF];

    alter table COPARAGRP
        add constraint DT559DI064913_DEFAULT DEFAULT 0 FOR [BUDGET_SUBMITTED_EFF];

    alter table COPARAGRP
        add constraint DT559DI064912_DEFAULT DEFAULT 0 FOR [BUDGET_APPROVED_EFF];

    alter table COPARAGRP
        add constraint DT559DI064911_DEFAULT DEFAULT 0 FOR [COST_PLANNED_THIS];

    alter table COPARAGRP
        add constraint DT559DI064910_DEFAULT DEFAULT 0 FOR [COST_ACT_THIS];

    alter table COPARAGRP
        add constraint DT559DI064909_DEFAULT DEFAULT 0 FOR [COST_REM_THIS];

    alter table COPARAGRP
        add constraint DT559DI064908_DEFAULT DEFAULT 0 FOR [COST_TOTAL_THIS];

    alter table COPARAGRP
        add constraint DT559DI064907_DEFAULT DEFAULT 0 FOR [EFFORT_PLANNED_THIS];

    alter table COPARAGRP
        add constraint DT559DI064906_DEFAULT DEFAULT 0 FOR [EFFORT_ACT_THIS];

    alter table COPARAGRP
        add constraint DT559DI064905_DEFAULT DEFAULT 0 FOR [EFFORT_REM_THIS];

    alter table COPARAGRP
        add constraint DT559DI064904_DEFAULT DEFAULT 0 FOR [EFFORT_TOTAL_THIS];

    alter table COPARAGRP
        add constraint DT559DI064978_DEFAULT DEFAULT 0 FOR [OBLIGO_IMPORT];

    update COPARAGRP set OBLIGO_IMPORT = DEFAULT;

    alter table COPARAGRP
        add constraint DT559DI064985_DEFAULT DEFAULT CONVERT(datetime2,'01.01.1970',104) FOR [CREATION_DATE];