You are viewing this site as a guest. You can still ask questions and help others! Join our Dev2Dev IT Community to receive your own blog, share your knowledge, and much more.

SQR Question

1 reply [Last post]
Guest's picture
Guest

Hi All,

I have one requirement ,like If an employee is terminated Today this employee has to send to Output file forperiod of 30 days ,after 30 days employee should drop of the file.

I have written the code in SQR like below
let $date1=dateadd(datenow(),'Day',30)
if $Current-date<=$date1
Let $write-flag1='Y'
end-if
but this SQR will run every day so the value of the Datenow() function will vary every day.so it is not working as per the above code
can any one Guide me How to Put condition from current date to 30 days in the SQR

Thanks in advance
suma

rahulkhandelw's picture
User offline. Last seen 9 years 28 weeks ago. Offline
Joined: 10/16/2009
Posts: 34
Re: SQR Question

Hi Suma,

You can achieve this in two ways.
1. Modify your SQL to select the employees who have been terminated in past 30 days
e.g.
where ACTION = 'TER'
and ACTION_DT between sysdate-30 and sysdate

2. You can use your existing logic, just replace datenow() with some date value like action date or effdt of termination row.

Does this make some sense to you, If not let me know I would explain it.

Regards,
Rahul Khandelwal