CREATE TABLE [dbo].[DocumentProcessingInfo] ( [DocumentProcessingInfoId] INT NOT NULL PRIMARY KEY IDENTITY, [DocumentId] UNIQUEIDENTIFIER NULL, [IngestorRunInfoId] UNIQUEIDENTIFIER NOT NULL, [CreatedDate] DATETIME NOT NULL, [DocumentValuePayload] VARCHAR(MAX) NOT NULL, [StatusType] INT NOT NULL, [DocumentFileName] VARCHAR(500) NOT NULL, [ProcessCount] INT NOT NULL DEFAULT 0, [DocumentType] VARCHAR(100) NOT NULL, [DocumentBusinessName] VARCHAR(500) NOT NULL, [EntityUnknown] BIT NOT NULL DEFAULT 0, CONSTRAINT [FK_DocumentProcessingInfo_IngestorRunInfo] FOREIGN KEY ([IngestorRunInfoId]) REFERENCES [IngestorRunInfo]([IngestorRunInfoId]) ) GO CREATE NONCLUSTERED INDEX [IX_DocumentProcessingInfo_IngestorRunInfoId_StatusType_CreatedDate] ON [dbo].[DocumentProcessingInfo] ( [IngestorRunInfoId] ASC, [StatusType] ASC, [CreatedDate] ASC ) INCLUDE([DocumentProcessingInfoId],[DocumentId],[DocumentValuePayload],[DocumentFileName],[ProcessCount],[DocumentType],[DocumentBusinessName],[EntityUnknown]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY] GO