CREATE TABLE [dbo].[SITContact]
(
[SITContactID] [int] NOT NULL IDENTITY(1, 1),
[OrderFID] [int] NOT NULL,
[SITTypeFID] [int] NOT NULL,
[AgentContactFID] [int] NULL,
[MilitaryCarrierContactFID] [int] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[SITContact] ADD CONSTRAINT [PK_SITContact] PRIMARY KEY NONCLUSTERED ([SITContactID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[SITContact] ADD CONSTRAINT [IX_SITContact_OrderFID_SITTypeFID_AgentContactFID_MilitaryCarrierContactFID] UNIQUE NONCLUSTERED ([OrderFID], [SITTypeFID], [AgentContactFID], [MilitaryCarrierContactFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[SITContact] ADD CONSTRAINT [FK_SITContact_AgentContactFID] FOREIGN KEY ([AgentContactFID]) REFERENCES [dbo].[AgentContact] ([AgentContactID])
GO
ALTER TABLE [dbo].[SITContact] ADD CONSTRAINT [FK_SITContact_MilitaryContactFID] FOREIGN KEY ([MilitaryCarrierContactFID]) REFERENCES [dbo].[MilitaryCarrierContact] ([MilitaryCarrierContactID])
GO
ALTER TABLE [dbo].[SITContact] ADD CONSTRAINT [FK_SITContact_Orders] FOREIGN KEY ([OrderFID]) REFERENCES [dbo].[Orders] ([PriKey])
GO
ALTER TABLE [dbo].[SITContact] ADD CONSTRAINT [FK_SITContact_SITType] FOREIGN KEY ([SITTypeFID]) REFERENCES [dbo].[SITType] ([SITTypeID])
GO
GRANT SELECT ON [dbo].[SITContact] TO [MssExec]
GRANT INSERT ON [dbo].[SITContact] TO [MssExec]
GRANT DELETE ON [dbo].[SITContact] TO [MssExec]
GRANT UPDATE ON [dbo].[SITContact] TO [MssExec]
GO