这是SQL作业计划每天运行的SP
DECLARE SR_cursor CURSOR FOR
SELECT RId
FROM [Table] SReq
where SReq.[Status] != 12345
AND (@FirstRun = True AND [RDate] > DATEADD(MONTH,-1,GETDATE()))
OR (@FirstRun = False AND [RDate] > DATEADD(DAY,-7,GETDATE()))
OPEN SReq_cursor
FETCH NEXT FROM SR_cursor
所以 @FirstRun 的日期是一个月,其他7天