[dbo].[DocumentAutoUploadRuleDetailHaulMode]
CREATE TABLE [dbo].[DocumentAutoUploadRuleDetailHaulMode]
(
[DocumentAutoUploadRuleDetailHaulModeID] [int] NOT NULL IDENTITY(1, 1),
[DocumentAutoUploadRuleDetailFID] [int] NOT NULL,
[HaulModeFID] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DocumentAutoUploadRuleDetailHaulMode] ADD CONSTRAINT [PK_DocumentAutoUploadRuleDetailHaulMode] PRIMARY KEY CLUSTERED ([DocumentAutoUploadRuleDetailHaulModeID]) ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_DocumentAutoUploadRuleDetailHaulMode_RuleDetail] ON [dbo].[DocumentAutoUploadRuleDetailHaulMode] ([DocumentAutoUploadRuleDetailFID], [HaulModeFID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_DocumentAutoUploadRuleDetailHaulMode_HaulMode] ON [dbo].[DocumentAutoUploadRuleDetailHaulMode] ([HaulModeFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DocumentAutoUploadRuleDetailHaulMode] ADD CONSTRAINT [FK_DocumentAutoUploadRuleDetailHaulMode_DocumentAutoUploadRuleDetail] FOREIGN KEY ([DocumentAutoUploadRuleDetailFID]) REFERENCES [dbo].[DocumentAutoUploadRuleDetail] ([DocumentAutoUploadRuleDetailID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[DocumentAutoUploadRuleDetailHaulMode] ADD CONSTRAINT [FK_DocumentAutoUploadRuleDetailHaulMode_HaulMode] FOREIGN KEY ([HaulModeFID]) REFERENCES [dbo].[HaulMode] ([HaulModeID]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[DocumentAutoUploadRuleDetailHaulMode] TO [MssExec]
GRANT INSERT ON [dbo].[DocumentAutoUploadRuleDetailHaulMode] TO [MssExec]
GRANT DELETE ON [dbo].[DocumentAutoUploadRuleDetailHaulMode] TO [MssExec]
GRANT UPDATE ON [dbo].[DocumentAutoUploadRuleDetailHaulMode] TO [MssExec]
GO