[dbo].[CustomerStatementOrderGroup]
CREATE TABLE [dbo].[CustomerStatementOrderGroup]
(
[CustomerStatementOrderGroupID] [int] NOT NULL IDENTITY(1, 1),
[CustomerStatementFID] [int] NOT NULL,
[CustomerStatementDocumentTypeFID] [int] NOT NULL,
[OrderNumber] [varchar] (23) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_CustomerStatementOrderGroup_OrderNumber] DEFAULT (''),
[Shipper] [varchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_CustomerStatementOrderGroup_Shipper] DEFAULT (''),
[Description] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_CustomerStatementOrderGroup_Description] DEFAULT (''),
[BalanceForwardDate] [datetime] NOT NULL,
[Amount] [money] NOT NULL,
[Balance] [money] NOT NULL CONSTRAINT [DF_CustomerStatementOrderGroup_Balance] DEFAULT ((0)),
[Status] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_CustomerStatementOrderGroup_Status] DEFAULT ('')
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[CustomerStatementOrderGroup] ADD CONSTRAINT [PK_CustomerStatementOrderGroup] PRIMARY KEY NONCLUSTERED ([CustomerStatementOrderGroupID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE CLUSTERED INDEX [IX_CustomerStatementOrderGroup_StatementFID] ON [dbo].[CustomerStatementOrderGroup] ([CustomerStatementFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_CustomerStatementOrderGroup_OrderNumber] ON [dbo].[CustomerStatementOrderGroup] ([OrderNumber]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[CustomerStatementOrderGroup] ADD CONSTRAINT [FK_CustomerStatementOrderGroup_CustomerStatementDocumentType] FOREIGN KEY ([CustomerStatementDocumentTypeFID]) REFERENCES [dbo].[CustomerStatementDocumentType] ([CustomerStatementDocumentTypeID])
GO
ALTER TABLE [dbo].[CustomerStatementOrderGroup] ADD CONSTRAINT [FK_CustomerStatementOrderGroup_CustomerStatement] FOREIGN KEY ([CustomerStatementFID]) REFERENCES [dbo].[CustomerStatement] ([CustomerStatementID]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[CustomerStatementOrderGroup] TO [MssExec]
GRANT INSERT ON [dbo].[CustomerStatementOrderGroup] TO [MssExec]
GRANT DELETE ON [dbo].[CustomerStatementOrderGroup] TO [MssExec]
GRANT UPDATE ON [dbo].[CustomerStatementOrderGroup] TO [MssExec]
GO