[dbo].[CustomerStatementImage]
CREATE TABLE [dbo].[CustomerStatementImage]
(
[CustomerStatementImageID] [int] NOT NULL IDENTITY(1, 1),
[CustomerStatementFID] [int] NOT NULL,
[CustomerStatementImage] [image] NOT NULL,
[ReportTypeFID] [smallint] NOT NULL,
[ReportArchiveTypeFID] [int] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[CustomerStatementImage] ADD CONSTRAINT [pk_CustomerStatementImage] PRIMARY KEY CLUSTERED ([CustomerStatementImageID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[CustomerStatementImage] ADD CONSTRAINT [FK_CustomerStatementImage_CustomerStatement] FOREIGN KEY ([CustomerStatementFID]) REFERENCES [dbo].[CustomerStatement] ([CustomerStatementID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[CustomerStatementImage] ADD CONSTRAINT [FK_CustomerStatementImage_ReportArchiveType] FOREIGN KEY ([ReportArchiveTypeFID]) REFERENCES [dbo].[ReportArchiveType] ([ReportArchiveTypeID])
GO
ALTER TABLE [dbo].[CustomerStatementImage] ADD CONSTRAINT [FK_CustomerStatementImage_ReportType] FOREIGN KEY ([ReportTypeFID]) REFERENCES [dbo].[ReportType] ([ReportTypeID])
GO
GRANT SELECT ON [dbo].[CustomerStatementImage] TO [MssExec]
GRANT INSERT ON [dbo].[CustomerStatementImage] TO [MssExec]
GRANT DELETE ON [dbo].[CustomerStatementImage] TO [MssExec]
GRANT UPDATE ON [dbo].[CustomerStatementImage] TO [MssExec]
GO