[dbo].[MilitaryAllocationDetail]
CREATE TABLE [dbo].[MilitaryAllocationDetail]
(
[MilitaryAllocationDetailID] [int] NOT NULL IDENTITY(1, 1),
[MilitaryAllocationHeaderFID] [int] NOT NULL,
[RevenueGroupFID] [int] NOT NULL,
[EffectiveStart] [datetime] NULL,
[EffectiveEnd] [datetime] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[MilitaryAllocationDetail] ADD CONSTRAINT [CK_MilitaryAllocationDetail_ValidEffectiveDates] CHECK ((isnull([EffectiveStart],(0))<isnull([EffectiveEnd],(100000)) AND (1)=[dbo].[MilitaryAllocationDetailEffectiveDates]([MilitaryAllocationHeaderFID],[RevenueGroupFID],[EffectiveStart],[EffectiveEnd])))
GO
ALTER TABLE [dbo].[MilitaryAllocationDetail] ADD CONSTRAINT [PK_MilitaryAllocationDetail] PRIMARY KEY CLUSTERED ([MilitaryAllocationDetailID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[MilitaryAllocationDetail] ADD CONSTRAINT [FK_MilitaryAllocationDetail_MilitaryAllocationHeader] FOREIGN KEY ([MilitaryAllocationHeaderFID]) REFERENCES [dbo].[MilitaryAllocationHeader] ([MilitaryAllocationHeaderID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[MilitaryAllocationDetail] ADD CONSTRAINT [FK_MilitaryAllocationDetail_RevenueGroup] FOREIGN KEY ([RevenueGroupFID]) REFERENCES [dbo].[RevGroups] ([RGPriKey])
GO
GRANT SELECT ON [dbo].[MilitaryAllocationDetail] TO [MssExec]
GRANT INSERT ON [dbo].[MilitaryAllocationDetail] TO [MssExec]
GRANT DELETE ON [dbo].[MilitaryAllocationDetail] TO [MssExec]
GRANT UPDATE ON [dbo].[MilitaryAllocationDetail] TO [MssExec]
GO