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 39 weeks 1 hour 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

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
The question below is to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.