[dbo].[ReductionTemplateItemCodeMap]
CREATE TABLE [dbo].[ReductionTemplateItemCodeMap]
(
[ReductionTemplateItemCodeMapID] [int] NOT NULL IDENTITY(1, 1),
[ReductionTemplateHeaderFID] [int] NOT NULL,
[ItemCodeFID] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ReductionTemplateItemCodeMap] ADD CONSTRAINT [PK_ReductionTemplateItemCodeMap] PRIMARY KEY NONCLUSTERED ([ReductionTemplateItemCodeMapID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ReductionTemplateItemCodeMap] ADD CONSTRAINT [IX_ReductionTemplateItemCodeMap_HeaderItemCode] UNIQUE NONCLUSTERED ([ReductionTemplateHeaderFID], [ItemCodeFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ReductionTemplateItemCodeMap] ADD CONSTRAINT [FK_ReductionTemplateItemCodeMap_ItemCode] FOREIGN KEY ([ItemCodeFID]) REFERENCES [dbo].[ItemCode] ([ICPriKey])
GO
ALTER TABLE [dbo].[ReductionTemplateItemCodeMap] ADD CONSTRAINT [FK_ReductionTemplateItemCodeMap_ReductionTemplateHeader] FOREIGN KEY ([ReductionTemplateHeaderFID]) REFERENCES [dbo].[ReductionTemplateHeader] ([ReductionTemplateID])
GO
GRANT SELECT ON [dbo].[ReductionTemplateItemCodeMap] TO [MssExec]
GRANT INSERT ON [dbo].[ReductionTemplateItemCodeMap] TO [MssExec]
GRANT DELETE ON [dbo].[ReductionTemplateItemCodeMap] TO [MssExec]
GRANT UPDATE ON [dbo].[ReductionTemplateItemCodeMap] TO [MssExec]
GO