I have the following script
@cStartDateIn CHAR(10) = '01/01/9999', -- dtmManualRunBeginDate in the DTS Global Variables paid date @cEndDateIn CHAR(10) = '01/01/9999', -- dtmManualRunEndDate in the DTS Global Variables @cStartDtIncr CHAR(10) = '01/01/9999', -- incurred date @cEndDtIncr CHAR(10) = '01/01/9999', @StartDateOut CHAR(10) = '01/01/9999' OUTPUT, @EndDateOut CHAR(10) = '01/01/9999' OUTPUT
--SET @sRunDt = @cLastRunDate SET @dtDateStart = CAST(@cStartDateIn AS DATETIME) SET @dtDateEnd = CAST(@cEndDateIn AS DATETIME) SET @dtDateStartInc = CAST(@cStartDtIncr AS DATETIME) SET @dtDateEndInc = CAST(@cEndDtIncr AS DATETIME)
IF @cFreq = 'M' BEGIN SET @dtDateStart = DATEADD(mm, DATEDIFF(mm,0,@CurDt) - 1, 0) -- First day of previous month SET @dtDateEnd = DATEADD(ms,-3,DATEADD(mm, DATEDIFF(mm,0,@CurDt), 0)) --Last day of previous month SET @dtDateStartInc = '01/01/2014' SET @dtDateEndInc = @dtDateEnd
that runs between the first and last day in a month now I want it to run from
01/01/2014 to the 5th of every month how do I implement that?
and the script is filtered by this date time field
WHERE ( clh.CLHDRLastActnDate BETWEEN @dtDateStart AND @dtDateEnd
This