[dbo].[DocumentAutoDownloadRuleDetailHaulMode]
CREATE TABLE [dbo].[DocumentAutoDownloadRuleDetailHaulMode]
(
[DocumentAutoDownloadRuleDetailHaulModeID] [int] NOT NULL IDENTITY(1, 1),
[DocumentAutoDownloadRuleDetailFID] [int] NOT NULL,
[HaulModeFID] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DocumentAutoDownloadRuleDetailHaulMode] ADD CONSTRAINT [PK_DocumentAutoDownloadRuleDetailHaulMode] PRIMARY KEY CLUSTERED ([DocumentAutoDownloadRuleDetailHaulModeID]) ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_DocumentAutoDownloadRuleDetailHaulMode_RuleDetail] ON [dbo].[DocumentAutoDownloadRuleDetailHaulMode] ([DocumentAutoDownloadRuleDetailFID], [HaulModeFID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_DocumentAutoDownloadRuleDetailHaulMode_HaulMode] ON [dbo].[DocumentAutoDownloadRuleDetailHaulMode] ([HaulModeFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DocumentAutoDownloadRuleDetailHaulMode] ADD CONSTRAINT [FK_DocumentAutoDownloadRuleDetailHaulMode_DocumentAutoDownloadRuleDetail] FOREIGN KEY ([DocumentAutoDownloadRuleDetailFID]) REFERENCES [dbo].[DocumentAutoDownloadRuleDetail] ([DocumentAutoDownloadRuleDetailID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[DocumentAutoDownloadRuleDetailHaulMode] ADD CONSTRAINT [FK_DocumentAutoDownloadRuleDetailHaulMode_HaulMode] FOREIGN KEY ([HaulModeFID]) REFERENCES [dbo].[HaulMode] ([HaulModeID]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[DocumentAutoDownloadRuleDetailHaulMode] TO [MssExec]
GRANT INSERT ON [dbo].[DocumentAutoDownloadRuleDetailHaulMode] TO [MssExec]
GRANT DELETE ON [dbo].[DocumentAutoDownloadRuleDetailHaulMode] TO [MssExec]
GRANT UPDATE ON [dbo].[DocumentAutoDownloadRuleDetailHaulMode] TO [MssExec]
GO