CREATE TABLE [dbo].[ATSplit] (
    [SplitWorkItemRef]  INT NOT NULL,
    [SourceWorkItemRef] INT NOT NULL,
    [JoinEventId]       INT NULL,
    [Flag]              INT NULL,
    CONSTRAINT [PK_ATSplit] PRIMARY KEY NONCLUSTERED ([SplitWorkItemRef] ASC),
    CONSTRAINT [ATSplit_FK1] FOREIGN KEY ([JoinEventId]) REFERENCES [dbo].[ATEventDefinition] ([EventID]),
    CONSTRAINT [ATSplit_FK2] FOREIGN KEY ([SplitWorkItemRef]) REFERENCES [dbo].[ATWorkItemReference] ([WorkItemReferenceId]),
    CONSTRAINT [ATSplit_FK3] FOREIGN KEY ([SourceWorkItemRef]) REFERENCES [dbo].[ATWorkItemReference] ([WorkItemReferenceId])
);


GO
CREATE NONCLUSTERED INDEX [IX_ATSplit]
    ON [dbo].[ATSplit]([SourceWorkItemRef] ASC);

