[dbo].[RevenueRatingImportDetail]
CREATE TABLE [dbo].[RevenueRatingImportDetail]
(
[RevenueRatingImportDetailID] [int] NOT NULL IDENTITY(1, 1),
[AgentFID] [int] NULL,
[AgentPercentage] [decimal] (12, 4) NULL,
[CartonCode] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Description] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Discount] [decimal] (12, 4) NULL,
[DistributionAmount] [decimal] (12, 4) NULL,
[DistributionCode] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[GrossAmount] [decimal] (12, 4) NULL,
[InvoiceAmount] [decimal] (12, 4) NULL,
[Quantity] [decimal] (12, 4) NULL,
[Rate] [decimal] (12, 4) NULL,
[RevenueRatingImportHeaderFID] [int] NOT NULL,
[RevenueType] [varchar] (4) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[InvoiceFlag] [bit] NULL,
[AddBackFlag] [bit] NULL CONSTRAINT [DF_RevenueRatingImportDetail_AddBackFlag] DEFAULT ((0)),
[PointOfServiceFID] [int] NULL,
[RateTypeFID] [int] NULL,
[Quantity2] [decimal] (12, 4) NULL,
[MilitaryItemCode] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[MilitaryItemCodeQualifier] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[RevenueRatingImportDetail] ADD CONSTRAINT [PK_RevenueRatingImportDetail] PRIMARY KEY NONCLUSTERED ([RevenueRatingImportDetailID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE CLUSTERED INDEX [IX_RevenueRatingImportHeaderFID] ON [dbo].[RevenueRatingImportDetail] ([RevenueRatingImportHeaderFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[RevenueRatingImportDetail] ADD CONSTRAINT [FK_RevenueRatingImportDetail_Agent] FOREIGN KEY ([AgentFID]) REFERENCES [dbo].[Agent] ([AgentPriKey])
GO
ALTER TABLE [dbo].[RevenueRatingImportDetail] ADD CONSTRAINT [FK_RevenueRatingImportDetail_PointOfService] FOREIGN KEY ([PointOfServiceFID]) REFERENCES [dbo].[PointOfService] ([PointOfServiceID]) ON DELETE SET NULL
GO
ALTER TABLE [dbo].[RevenueRatingImportDetail] ADD CONSTRAINT [FK_RevenueRatingImportDetail_RateType] FOREIGN KEY ([RateTypeFID]) REFERENCES [dbo].[RateTypes] ([RTypePriKey]) ON DELETE SET NULL
GO
ALTER TABLE [dbo].[RevenueRatingImportDetail] ADD CONSTRAINT [FK_RevenueRatingImportDetail_RevenueRatingImportHeader] FOREIGN KEY ([RevenueRatingImportHeaderFID]) REFERENCES [dbo].[RevenueRatingImportHeader] ([RevenueRatingImportHeaderID]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[RevenueRatingImportDetail] TO [MssExec]
GRANT INSERT ON [dbo].[RevenueRatingImportDetail] TO [MssExec]
GRANT DELETE ON [dbo].[RevenueRatingImportDetail] TO [MssExec]
GRANT UPDATE ON [dbo].[RevenueRatingImportDetail] TO [MssExec]
GO