Page 1 of 1

Question on Extraction

Posted: Wed Jan 23, 2008 7:53 pm
by cosec
I have a job that extracts from certain table based on the current date and loads it on to a table.

sample:

select A.aaa,A.bbb from table A
where current date = date(send_dttm) + 2 days;

Last night my job started at 23.45 pm and finished at 00.15 this morning.


I have checked my extraction and loading and as expected it has been done using the current date as yesterday(2008-01-23).

Will there be a possibility that the current date will be used as 2008-01-24 when the extraction goes over to the next day ??

Posted: Wed Jan 23, 2008 8:06 pm
by ray.wurlod
That would depend entirely on how you specify "current date" and how the database server handles that. For example, if you specify it as "job start date" then there's no way it can carry over.

Posted: Wed Jan 23, 2008 8:33 pm
by cosec
ray.wurlod wrote:That would depend entirely on how you specify "current date" and how the database server handles that. For example, if you specify it as "job start date" then there's no way it can carry over. ...
The current Date is specified as I had given in the sample above.

So in the DB2 stage SQL portion how do I replace the current date with the DSJobstartDate ??

Posted: Thu Jan 24, 2008 1:44 am
by ray.wurlod
Create a job parameter called, say, jpRunDate. Assign its value from a job sequence that generates the appropriate value, whether from a function, a macro, or whatever. Use a reference to this parameter instead of current date in your WHERE clause.

Posted: Thu Jan 24, 2008 8:32 am
by chulett
"Goes over to the next day"? :?

Current date is current date and simply running over midnight doesn't change the value of the 'current date' when the the query started, which is when it would be evaluated. Of course, if you start after midnight, then of course it will use the 'next' date.

Posted: Tue Jan 29, 2008 1:14 am
by SHARAD123
Hi,
It ll be better to create a temporary table holding the info for the current run. So that whatever changes u can retrieve it from the temporary table.

Note: Everytime you run jus truncate the temporary table and re-run it so that oly the current details will be there in the table

Posted: Tue Jan 29, 2008 1:15 am
by SHARAD123
Hi,
It ll be better to create a temporary table holding the info for the current run. So that whatever changes u can retrieve it from the temporary table.

Note: Everytime you run jus truncate the temporary table and re-run it so that oly the current details will be there in the table