[dbo].[ReductionTemplateIncludedReduction]
CREATE TABLE [dbo].[ReductionTemplateIncludedReduction]
(
[ReductionTemplateIncludedReductionID] [int] NOT NULL IDENTITY(1, 1),
[ReductionTemplateDetailFID] [int] NOT NULL,
[OtherTemplateReductionFID] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ReductionTemplateIncludedReduction] ADD CONSTRAINT [CK_ReductionTemplateIncludedReduction_CircularReductionCheck] CHECK (((1)=[dbo].[ReductionTemplateIncludedReductionValidMapping]([ReductionTemplateDetailFID],[OtherTemplateReductionFID])))
GO
ALTER TABLE [dbo].[ReductionTemplateIncludedReduction] ADD CONSTRAINT [PK_ReductionTemplateIncludedReduction] PRIMARY KEY NONCLUSTERED ([ReductionTemplateIncludedReductionID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ReductionTemplateIncludedReduction] ADD CONSTRAINT [IX_ReductionTemplateIncludedReduction_ReductionTemplateDetailFID] UNIQUE CLUSTERED ([ReductionTemplateDetailFID], [OtherTemplateReductionFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ReductionTemplateIncludedReduction] ADD CONSTRAINT [FK_ReductionTemplateIncludedReduction_OtherTemplateReduction] FOREIGN KEY ([OtherTemplateReductionFID]) REFERENCES [dbo].[ReductionTemplateHeader] ([ReductionTemplateID])
GO
ALTER TABLE [dbo].[ReductionTemplateIncludedReduction] ADD CONSTRAINT [FK_ReductionTemplateIncludedReduction_ReductionTemplateDetail] FOREIGN KEY ([ReductionTemplateDetailFID]) REFERENCES [dbo].[ReductionTemplateDetail] ([ReductionTemplateDetailID])
GO
GRANT SELECT ON [dbo].[ReductionTemplateIncludedReduction] TO [MssExec]
GRANT INSERT ON [dbo].[ReductionTemplateIncludedReduction] TO [MssExec]
GRANT DELETE ON [dbo].[ReductionTemplateIncludedReduction] TO [MssExec]
GRANT UPDATE ON [dbo].[ReductionTemplateIncludedReduction] TO [MssExec]
GO