[dbo].[FieldRequirementEventDetail]
CREATE TABLE [dbo].[FieldRequirementEventDetail]
(
[FieldRequirementEventDetailID] [int] NOT NULL IDENTITY(1, 1),
[FieldRequirementEventFID] [int] NOT NULL,
[ShipmentTypeFID] [int] NULL,
[RequireableFieldFID] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[FieldRequirementEventDetail] ADD CONSTRAINT [PK_FieldRequirementEventDetail] PRIMARY KEY NONCLUSTERED ([FieldRequirementEventDetailID]) ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_FieldRequirementEventDetail_FieldRequirementEventFID_ShipmentTypeFID_RequireableFieldFID] ON [dbo].[FieldRequirementEventDetail] ([FieldRequirementEventFID], [ShipmentTypeFID], [RequireableFieldFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[FieldRequirementEventDetail] ADD CONSTRAINT [FK_FieldRequirementEventDetail_FieldRequirementEvent] FOREIGN KEY ([FieldRequirementEventFID]) REFERENCES [dbo].[FieldRequirementEvent] ([FieldRequirementEventID])
GO
ALTER TABLE [dbo].[FieldRequirementEventDetail] ADD CONSTRAINT [FK_FieldRequirementEventDetail_RequireableField] FOREIGN KEY ([RequireableFieldFID]) REFERENCES [dbo].[RequireableField] ([RequireableFieldID])
GO
ALTER TABLE [dbo].[FieldRequirementEventDetail] ADD CONSTRAINT [FK_FieldRequirementEventDetail_ShipmentType] FOREIGN KEY ([ShipmentTypeFID]) REFERENCES [dbo].[ShipmentType] ([ShipmentTypeID])
GO
GRANT SELECT ON [dbo].[FieldRequirementEventDetail] TO [MssExec]
GRANT INSERT ON [dbo].[FieldRequirementEventDetail] TO [MssExec]
GRANT DELETE ON [dbo].[FieldRequirementEventDetail] TO [MssExec]
GRANT UPDATE ON [dbo].[FieldRequirementEventDetail] TO [MssExec]
GO