CREATE TABLE [dbo].[ATNote] (
    [NoteId]     INT             NOT NULL IDENTITY (1,1),
    [WorkItemId] INT             NOT NULL,
    [DocumentId] INT             NULL,
    [Submitter]  NVARCHAR (50)   NOT NULL,
    [SubmitDate] DATETIME        NOT NULL,
    [Note]       NVARCHAR (1024) NOT NULL,
    CONSTRAINT [PK_ATNote] PRIMARY KEY NONCLUSTERED ([NoteId] ASC),
    CONSTRAINT [FK_ATNote_ATWorkItem] FOREIGN KEY ([WorkItemId]) REFERENCES [dbo].[ATWorkItem] ([WorkItemId]),
    CONSTRAINT [FK_ATNote_ATDocument] FOREIGN KEY ([DocumentId]) REFERENCES [dbo].[ATDocument] ([DocumentId])
);


GO
CREATE NONCLUSTERED INDEX [ATNote_WorkitemId]
    ON [dbo].[ATNote]([WorkItemId] ASC);

