CREATE TABLE [dbo].[CommStmtHeader]
(
[MSID] [int] NOT NULL IDENTITY(1, 1),
[VendorClassID] [varchar] (11) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[VendorClass] [varchar] (31) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[DateCreated] [datetime] NOT NULL,
[ToDate] [datetime] NOT NULL,
[Final] [bit] NOT NULL,
[FinalizedBy] [int] NULL,
[FinalizedOn] [datetime] NULL,
[CreatedBy] [int] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[CommStmtHeader] ADD CONSTRAINT [PK_CommStmtHeader] PRIMARY KEY NONCLUSTERED ([MSID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_CommStmtHeader_CreatedBy] ON [dbo].[CommStmtHeader] ([CreatedBy]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_CommStmtHeader_FinalizedBy] ON [dbo].[CommStmtHeader] ([FinalizedBy]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[CommStmtHeader] ADD CONSTRAINT [FK_CommStmtHeader_Sysuser_CreatedBy] FOREIGN KEY ([CreatedBy]) REFERENCES [dbo].[Sysuser] ([SysUserID])
GO
ALTER TABLE [dbo].[CommStmtHeader] ADD CONSTRAINT [FK_CommStmtHeader_Sysuser] FOREIGN KEY ([FinalizedBy]) REFERENCES [dbo].[Sysuser] ([SysUserID])
GO
GRANT SELECT ON [dbo].[CommStmtHeader] TO [MssExec]
GRANT INSERT ON [dbo].[CommStmtHeader] TO [MssExec]
GRANT DELETE ON [dbo].[CommStmtHeader] TO [MssExec]
GRANT UPDATE ON [dbo].[CommStmtHeader] TO [MssExec]
GO