CREATE TABLE General_ReportScheduling
                              (RSR_Sequence integer Identity(1,1) NOT NULL,
                               RSR_ReportOrGroupFileName VarChar(120) NOT NULL,
                               RSR_SchedReportDesc varchar(150) Not NULL default '#',
                               RSR_ReportOrGroupLocation VarChar(40) Not NULL default '#',
                               RSR_IsReportAGroup bit not null default 0,
                               RSR_Frequency tinyint NOT NULL default 0,
                               RSR_AddedRepID VarChar(20) NOT NULL,
                               RSR_Enabled bit not null default 1,
                               RSR_AdditionalDestination bit not null default 0,
                               RSR_AddlToEmailAddrs varchar(100) NULL,
                               RSR_CCEmailAddr varchar(100) NULL,
                               RSR_RptDescriptor varchar(100) NULL,
                               RSR_MailFaxSubject varchar(250),
                               RSR_MailBodyCoverText varchar(1000),
                               RSR_SaveAfterGenerate bit not null default 1,
                               RSR_SuppressClientDest bit not null default 1,
                               RSR_ApplyOffset bit not null default 1,
                               RSR_OffsetDays smallint not null default 0,
                               RSR_PrintAfterGenerate bit not null default 0,
                               RSR_EmailFaxAfterGenerate bit not null default 0,
                               RSR_SaveFinalAfterGenerate bit not null default 0,
                               RSR_SaveUnderMergeFolders bit not null default 0,
                               RSR_RepSetFolderName VarChar(50) null,
                               RSR_FinalRepOpType tinyint not null default 0,
                               RSR_RepStartDate DateTime Null,
                               RSR_RepEndDate DateTime Null,
                               RSR_StartDateType tinyint NOT NULL default 0,
                               RSR_EndDateType tinyint NOT NULL default 1,
                               RSR_GoBackQuantity tinyint NULL default 0,
                               RSR_GoBackUnits tinyint NULL default 0,
                               RSR_OverrideMergeCriteria tinyint NULL default 0,
                               RSR_SavedFNamePSType tinyint NULL default 0,
                               RSR_PreOrSufFixFldNameOrString varchar(50) NULL,
                               RSR_RegOrFPSortOrderStr varchar(255) NULL,
			       RSR_DontConsolidateRepOP bit null default 0,
			       RSR_RecentRunStatusIdx tinyint NULL default 0,
			       RSR_SkipLastRunAccts bit null default 0,
			       RSR_LastRunDateTime DateTime null,
			       RSR_RepRunSessionID varchar(50) NULL,
			       RSR_ClearPreviousArchFiles bit null default 1,
			       RSR_FilePathFldNameOrString varchar(50) NULL, 
			       RSR_EmailOutputType tinyint NOT NULL default 0,	
				RSR_PdfInsertEnabled bit null default 0,
				RSR_PdfInsertPosition tinyint null default 0,
				RSR_PdfInsertPathFname varchar(120),
                               CONSTRAINT PK_General_ReportScheduling PRIMARY KEY NONCLUSTERED (RSR_Sequence)
                              );

ALTER TABLE [dbo].[General_ReportScheduling] ADD
	CONSTRAINT [FK_General_ReportScheduling_General_UserInfo] FOREIGN KEY
	(
		[RSR_AddedRepID]
	) REFERENCES [dbo].[General_UserInfo] (
		[CUC_LoginName]
	) ON UPDATE CASCADE ON DELETE CASCADE

