[dbo].[CustomerStatementDetail]
CREATE TABLE [dbo].[CustomerStatementDetail]
(
[CustomerStatementDetailID] [int] NOT NULL IDENTITY(1, 1),
[CustomerStatementInvoiceGroupFID] [int] NOT NULL,
[CustomerStatementDocumentTypeFID] [int] NOT NULL,
[DocumentNumber] [varchar] (23) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Description] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[DocumentDate] [datetime] NOT NULL,
[Amount] [money] NOT NULL,
[Status] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_CustomerStatementDetail_Status] DEFAULT (''),
[Visible] [bit] NOT NULL CONSTRAINT [DF_CustomerStatementDetail_Visible] DEFAULT ((0)),
[IncludedOnInvoiceFlag] [bit] NOT NULL CONSTRAINT [DF_CustomerStatementDetail_IncludedOnInvoiceFlag] DEFAULT ((0))
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[CustomerStatementDetail] ADD CONSTRAINT [PK_CustomerStatementDetail] PRIMARY KEY NONCLUSTERED ([CustomerStatementDetailID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE CLUSTERED INDEX [IX_CustomerStatementDetail_InvoiceGroupFID] ON [dbo].[CustomerStatementDetail] ([CustomerStatementInvoiceGroupFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[CustomerStatementDetail] ADD CONSTRAINT [FK_CustomerStatementDetail_CustomerStatementDocumentType] FOREIGN KEY ([CustomerStatementDocumentTypeFID]) REFERENCES [dbo].[CustomerStatementDocumentType] ([CustomerStatementDocumentTypeID])
GO
ALTER TABLE [dbo].[CustomerStatementDetail] ADD CONSTRAINT [FK_CustomerStatementDetail_CustomerStatementInvoiceGroup] FOREIGN KEY ([CustomerStatementInvoiceGroupFID]) REFERENCES [dbo].[CustomerStatementInvoiceGroup] ([CustomerStatementInvoiceGroupID]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[CustomerStatementDetail] TO [MssExec]
GRANT INSERT ON [dbo].[CustomerStatementDetail] TO [MssExec]
GRANT DELETE ON [dbo].[CustomerStatementDetail] TO [MssExec]
GRANT UPDATE ON [dbo].[CustomerStatementDetail] TO [MssExec]
GO