[dbo].[QuoteTemplateDetail]
CREATE TABLE [dbo].[QuoteTemplateDetail]
(
[QuoteTemplateDetailID] [int] NOT NULL IDENTITY(1, 1),
[QuoteTemplateFID] [int] NOT NULL,
[ItemCodeFID] [int] NULL,
[Description] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[RateTypeFID] [int] NULL,
[SortOrder] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[QuoteTemplateDetail] ADD CONSTRAINT [PK_QuoteTemplateDetail] PRIMARY KEY NONCLUSTERED ([QuoteTemplateDetailID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_QuoteTemplateDetail_QuoteTemplateFID] ON [dbo].[QuoteTemplateDetail] ([QuoteTemplateFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[QuoteTemplateDetail] ADD CONSTRAINT [FK_QuoteTemplateDetail_ItemCode] FOREIGN KEY ([ItemCodeFID]) REFERENCES [dbo].[ItemCode] ([ICPriKey])
GO
ALTER TABLE [dbo].[QuoteTemplateDetail] ADD CONSTRAINT [FK_QuoteTemplateDetail_QuoteTemplate] FOREIGN KEY ([QuoteTemplateFID]) REFERENCES [dbo].[QuoteTemplate] ([QuoteTemplateID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[QuoteTemplateDetail] ADD CONSTRAINT [FK_QuoteTemplateDetail_RateType] FOREIGN KEY ([RateTypeFID]) REFERENCES [dbo].[RateTypes] ([RTypePriKey])
GO
GRANT SELECT ON [dbo].[QuoteTemplateDetail] TO [MssExec]
GRANT INSERT ON [dbo].[QuoteTemplateDetail] TO [MssExec]
GRANT DELETE ON [dbo].[QuoteTemplateDetail] TO [MssExec]
GRANT UPDATE ON [dbo].[QuoteTemplateDetail] TO [MssExec]
GO