[dbo].[DocumentAutoUploadRuleDetailVanLine]
CREATE TABLE [dbo].[DocumentAutoUploadRuleDetailVanLine]
(
[DocumentAutoUploadRuleDetailVanLineID] [int] NOT NULL IDENTITY(1, 1),
[DocumentAutoUploadRuleDetailFID] [int] NOT NULL,
[VanLineFID] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DocumentAutoUploadRuleDetailVanLine] ADD CONSTRAINT [PK_DocumentAutoUploadRuleDetailVanLine] PRIMARY KEY CLUSTERED ([DocumentAutoUploadRuleDetailVanLineID]) ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_DocumentAutoUploadRuleDetailVanLine_RuleDetail] ON [dbo].[DocumentAutoUploadRuleDetailVanLine] ([DocumentAutoUploadRuleDetailFID], [VanLineFID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_DocumentAutoUploadRuleDetailVanLine_VanLine] ON [dbo].[DocumentAutoUploadRuleDetailVanLine] ([VanLineFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DocumentAutoUploadRuleDetailVanLine] ADD CONSTRAINT [FK_DocumentAutoUploadRuleDetailVanLine_DocumentAutoUploadRuleDetail] FOREIGN KEY ([DocumentAutoUploadRuleDetailFID]) REFERENCES [dbo].[DocumentAutoUploadRuleDetail] ([DocumentAutoUploadRuleDetailID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[DocumentAutoUploadRuleDetailVanLine] ADD CONSTRAINT [FK_DocumentAutoUploadRuleDetailVanLine_VanLine] FOREIGN KEY ([VanLineFID]) REFERENCES [dbo].[VanLine] ([VLPriKey]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[DocumentAutoUploadRuleDetailVanLine] TO [MssExec]
GRANT INSERT ON [dbo].[DocumentAutoUploadRuleDetailVanLine] TO [MssExec]
GRANT DELETE ON [dbo].[DocumentAutoUploadRuleDetailVanLine] TO [MssExec]
GRANT UPDATE ON [dbo].[DocumentAutoUploadRuleDetailVanLine] TO [MssExec]
GO