[dbo].[OutgoingEmailOrderMap]
CREATE TABLE [dbo].[OutgoingEmailOrderMap]
(
[OutgoingEmailOrderMapId] [int] NOT NULL IDENTITY(1, 1),
[OutgoingEmailFID] [int] NOT NULL,
[OrderFID] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[OutgoingEmailOrderMap] ADD CONSTRAINT [PK_OutgoingEmailOrderMap] PRIMARY KEY NONCLUSTERED ([OutgoingEmailOrderMapId]) ON [PRIMARY]
GO
CREATE UNIQUE CLUSTERED INDEX [IX_OutgoingEmailOrderMap_OrderFID_OutgoingEmailFID] ON [dbo].[OutgoingEmailOrderMap] ([OrderFID], [OutgoingEmailFID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_OutgoingEmailOrderMap_OutgoingEmailFID] ON [dbo].[OutgoingEmailOrderMap] ([OutgoingEmailFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[OutgoingEmailOrderMap] ADD CONSTRAINT [FK_OutgoingEmailOrderMap_Orders] FOREIGN KEY ([OrderFID]) REFERENCES [dbo].[Orders] ([PriKey]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[OutgoingEmailOrderMap] ADD CONSTRAINT [FK_OutgoingEmailOrderMap_OutgoingEmail] FOREIGN KEY ([OutgoingEmailFID]) REFERENCES [dbo].[OutgoingEmail] ([OutgoingEmailID]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[OutgoingEmailOrderMap] TO [MssExec]
GRANT INSERT ON [dbo].[OutgoingEmailOrderMap] TO [MssExec]
GRANT DELETE ON [dbo].[OutgoingEmailOrderMap] TO [MssExec]
GRANT UPDATE ON [dbo].[OutgoingEmailOrderMap] TO [MssExec]
GO