[dbo].[RevenueRatingImportInvoiceDetail]
CREATE TABLE [dbo].[RevenueRatingImportInvoiceDetail]
(
[RevenueRatingImportInvoiceDetailID] [int] NOT NULL IDENTITY(1, 1),
[RevenueRatingImportHeaderFID] [int] NOT NULL,
[AgentFID] [int] NULL,
[Description] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[GrossAmount] [decimal] (12, 4) NULL,
[DiscountPct] [decimal] (12, 4) NULL,
[DistributionCode] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[PrintDescription] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Quantity2] [decimal] (12, 4) NULL,
[Quantity] [decimal] (12, 4) NULL,
[Rate] [decimal] (12, 4) NULL,
[RateTypeFID] [int] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[RevenueRatingImportInvoiceDetail] ADD CONSTRAINT [PK_RevenueRatingImportInvoiceDetail] PRIMARY KEY NONCLUSTERED ([RevenueRatingImportInvoiceDetailID]) ON [PRIMARY]
GO
CREATE CLUSTERED INDEX [IX_RevenueRatingImportInvoiceDetailFID] ON [dbo].[RevenueRatingImportInvoiceDetail] ([RevenueRatingImportHeaderFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[RevenueRatingImportInvoiceDetail] ADD CONSTRAINT [FK_RevenueRatingImportInvoiceDetail_Agent] FOREIGN KEY ([AgentFID]) REFERENCES [dbo].[Agent] ([AgentPriKey])
GO
ALTER TABLE [dbo].[RevenueRatingImportInvoiceDetail] ADD CONSTRAINT [FK_RevenueRatingImportInvoiceDetail_RateType] FOREIGN KEY ([RateTypeFID]) REFERENCES [dbo].[RateTypes] ([RTypePriKey]) ON DELETE SET NULL
GO
ALTER TABLE [dbo].[RevenueRatingImportInvoiceDetail] ADD CONSTRAINT [FK_RevenueRatingImportInvoiceDetail_RevenueRatingImportHeader] FOREIGN KEY ([RevenueRatingImportHeaderFID]) REFERENCES [dbo].[RevenueRatingImportHeader] ([RevenueRatingImportHeaderID]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[RevenueRatingImportInvoiceDetail] TO [MssExec]
GRANT INSERT ON [dbo].[RevenueRatingImportInvoiceDetail] TO [MssExec]
GRANT DELETE ON [dbo].[RevenueRatingImportInvoiceDetail] TO [MssExec]
GRANT UPDATE ON [dbo].[RevenueRatingImportInvoiceDetail] TO [MssExec]
GO