
    create table [SYSTEM] (
        [UUID] uniqueidentifier default newid() not null,
        [CREATED_ON] datetime2 default CONVERT(datetime2,'01.01.1970',104),
        [MODIFIED_ON] datetime2 default CONVERT(datetime2,'01.01.1970',104),
        [RWDU] numeric(5,0) default 0,
        [CREATED_BY] varchar(20),
        [MODIFIED_BY] varchar(20),
        [OWN_LIC] varchar(4),
        [OPC] varchar(8),
        [OWNER] numeric(5,0) default 0,
        [GROUP] numeric(5,0) default 0,
        [ANY] numeric(5,0) default 0,
        [SYSTEM_TYPE] numeric(10,0) default 0,
        [POSITION] numeric(10,0) default 0
    );

    alter table [SYSTEM] 
        add constraint PIDSYSTEM primary key ([UUID]);

    alter table [SYSTEM] 
        add constraint DT568UUID_NOT_NULL check([UUID] is not null);

    create table SYSTEMCOND (
        [UUID] uniqueidentifier default newid() not null,
        [SYSTEM] uniqueidentifier not null,
        [CREATED_ON] datetime2 default CONVERT(datetime2,'01.01.1970',104),
        [MODIFIED_ON] datetime2 default CONVERT(datetime2,'01.01.1970',104),
        [RWDU] numeric(5,0) default 0,
        [CREATED_BY] varchar(20),
        [MODIFIED_BY] varchar(20),
        [OWN_LIC] varchar(4),
        [OPC] varchar(8),
        [OWNER] numeric(5,0) default 0,
        [GROUP] numeric(5,0) default 0,
        [ANY] numeric(5,0) default 0,
        [CHECK_CLASS] varchar(100),
        [PARAMETER] varchar(100),
        [EXPECTED_VALUE] numeric(5,0) default 0
    );

    alter table SYSTEMCOND 
        add constraint PIDSYSTEMCOND primary key ([UUID]);

    alter table SYSTEMCOND 
        add constraint DT569UUID_NOT_NULL check([UUID] is not null);

    alter table SYSTEMCOND 
        add constraint DT569SYSTEM_NOT_NULL check([SYSTEM] is not null);

    alter table SYSTEMCOND 
        add constraint FKSYSTEMCONDID568 
        foreign key ([SYSTEM]) 
        references [SYSTEM]        
        on delete no action;
        
    CREATE TRIGGER UFKSYSTEMCONDID568 ON [SYSTEM]
        FOR DELETE
        AS
        BEGIN
            DELETE t
            FROM DELETED d
                INNER JOIN SYSTEMCOND t ON d.UUID = t.[SYSTEM]
        END;

alter table INTERFACE_PARAMETER add [SYSTEM] uniqueidentifier;

    CREATE TRIGGER UFKINTERFACE_PARAMETERID568 ON [SYSTEM]
        FOR DELETE
        AS
        BEGIN
            DELETE t
            FROM DELETED d
                INNER JOIN INTERFACE_PARAMETER t ON d.UUID = t.[SYSTEM]
        END;