
[dbo].[StatementDetailDistInvoice]
CREATE TABLE [dbo].[StatementDetailDistInvoice]
(
[StatementDetailDistInvoiceID] [int] NOT NULL IDENTITY(1, 1),
[StatementDetailDistFID] [int] NOT NULL,
[CustomerNumber] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[InvoiceNumber] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Amount] [money] NULL,
[AccountingCustomerFid] [int] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[StatementDetailDistInvoice] ADD CONSTRAINT [PK_StatementDetailDistInvoice] PRIMARY KEY CLUSTERED ([StatementDetailDistInvoiceID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_StatementDetailDistInvoice_StatementDetailDistID] ON [dbo].[StatementDetailDistInvoice] ([StatementDetailDistFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[StatementDetailDistInvoice] ADD CONSTRAINT [FK_StatementDetailDistInvoice_AccountingCustomer] FOREIGN KEY ([AccountingCustomerFid]) REFERENCES [dbo].[AccountingCustomer] ([AccountingCustomerId])
GO
ALTER TABLE [dbo].[StatementDetailDistInvoice] ADD CONSTRAINT [FK_StatementDetailDistInvoice_StatementDetailDistID] FOREIGN KEY ([StatementDetailDistFID]) REFERENCES [dbo].[StatementDetailDist] ([SDDPriKey]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[StatementDetailDistInvoice] TO [MssExec]
GRANT INSERT ON [dbo].[StatementDetailDistInvoice] TO [MssExec]
GRANT DELETE ON [dbo].[StatementDetailDistInvoice] TO [MssExec]
GRANT UPDATE ON [dbo].[StatementDetailDistInvoice] TO [MssExec]
GO