[dbo].[MilitaryAllocationItemCodeException]
CREATE TABLE [dbo].[MilitaryAllocationItemCodeException]
(
[MilitaryAllocationItemCodeExceptionID] [int] NOT NULL IDENTITY(1, 1),
[MilitaryAllocationItemCodeFID] [int] NOT NULL,
[ExceptionTypeFID] [int] NOT NULL,
[PointOfServiceFID] [int] NOT NULL,
[PayAgentFID] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[MilitaryAllocationItemCodeException] ADD CONSTRAINT [CK_MilitaryAllocationItemCodeException_ValidPayAgent] CHECK (((0)=[dbo].[CheckAllocationExceptionValidPayAgent]([MilitaryAllocationItemCodeFID],[PayAgentFID])))
GO
ALTER TABLE [dbo].[MilitaryAllocationItemCodeException] ADD CONSTRAINT [PK_MilitaryAllocationItemCodeException] PRIMARY KEY CLUSTERED ([MilitaryAllocationItemCodeExceptionID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[MilitaryAllocationItemCodeException] ADD CONSTRAINT [IX_MilitaryAllocationItemCodeException_ExceptionType_PointOfService] UNIQUE NONCLUSTERED ([MilitaryAllocationItemCodeFID], [ExceptionTypeFID], [PointOfServiceFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[MilitaryAllocationItemCodeException] ADD CONSTRAINT [FK_MilitaryAllocationItemCodeException_ExceptionType] FOREIGN KEY ([ExceptionTypeFID]) REFERENCES [dbo].[ExceptionType] ([ExceptionTypeID])
GO
ALTER TABLE [dbo].[MilitaryAllocationItemCodeException] ADD CONSTRAINT [FK_MilitaryAllocationItemCodeException_MilitaryAllocationItemCode] FOREIGN KEY ([MilitaryAllocationItemCodeFID]) REFERENCES [dbo].[MilitaryAllocationItemCode] ([MilitaryAllocationItemCodeID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[MilitaryAllocationItemCodeException] ADD CONSTRAINT [FK_MilitaryAllocationItemCodeException_PreferredRevenueAgent] FOREIGN KEY ([PayAgentFID]) REFERENCES [dbo].[PreferredRevenueAgent] ([PreferredRevenueAgentID])
GO
ALTER TABLE [dbo].[MilitaryAllocationItemCodeException] ADD CONSTRAINT [FK_MilitaryAllocationItemCodeException_PointOfService] FOREIGN KEY ([PointOfServiceFID]) REFERENCES [dbo].[PointOfService] ([PointOfServiceID])
GO
GRANT SELECT ON [dbo].[MilitaryAllocationItemCodeException] TO [MssExec]
GRANT INSERT ON [dbo].[MilitaryAllocationItemCodeException] TO [MssExec]
GRANT DELETE ON [dbo].[MilitaryAllocationItemCodeException] TO [MssExec]
GRANT UPDATE ON [dbo].[MilitaryAllocationItemCodeException] TO [MssExec]
GO