CREATE TABLE [dbo].[HtmlLetter]
(
[HtmlLetterID] [int] NOT NULL IDENTITY(1, 1),
[ReportMenuName] [varchar] (425) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[ReportSystemLocationFID] [int] NULL,
[ReportGroupFID] [int] NULL,
[DocumentTypeFID] [int] NOT NULL,
[CreatedOn] [datetime] NOT NULL,
[CreatedBy] [int] NOT NULL,
[LastEdited] [datetime] NULL,
[LastEditedBy] [int] NULL,
[TimesUsed] [int] NOT NULL,
[LetterContent] [nvarchar] (max) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[MarginLeft] [float] NOT NULL,
[MarginRight] [float] NOT NULL,
[MarginTop] [float] NOT NULL,
[MarginBottom] [float] NOT NULL,
[PageWidth] [float] NOT NULL,
[PageHeight] [float] NOT NULL,
[IsLandscape] [bit] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[HtmlLetter] ADD CONSTRAINT [PK_HtmlLetter] PRIMARY KEY CLUSTERED ([HtmlLetterID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[HtmlLetter] ADD CONSTRAINT [FK_HtmlLetter_DocumentType] FOREIGN KEY ([DocumentTypeFID]) REFERENCES [dbo].[DocumentType] ([DocumentTypeID])
GO
ALTER TABLE [dbo].[HtmlLetter] ADD CONSTRAINT [FK_HtmlLetter_ReportGroup] FOREIGN KEY ([ReportGroupFID]) REFERENCES [dbo].[ReportGroup] ([ReportGroupID]) ON DELETE SET NULL
GO
ALTER TABLE [dbo].[HtmlLetter] ADD CONSTRAINT [FK_HtmlLetter_ReportSystemLocation] FOREIGN KEY ([ReportSystemLocationFID]) REFERENCES [dbo].[ReportSystemLocation] ([ReportSystemLocationID])
GO
GRANT SELECT ON [dbo].[HtmlLetter] TO [MssExec]
GRANT INSERT ON [dbo].[HtmlLetter] TO [MssExec]
GRANT DELETE ON [dbo].[HtmlLetter] TO [MssExec]
GRANT UPDATE ON [dbo].[HtmlLetter] TO [MssExec]
GO