Timestamp in DB2

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
rkumar28
Participant
Posts: 43
Joined: Tue Mar 30, 2004 9:39 am

Timestamp in DB2

Post by rkumar28 »

Hi,

I am extrating data from DB2 using DataStage native API for DB2/UDB. I have a User defined SQL. Based on the SQL logic the data is extracted weekly to a pipe delimited file and FTPed.

I need some giudance with a portion of SQL query below. I extract one week data from the table with the logic below:

Select ....... from table1
where
....
AND
Schema1.TableName.TIMECREATED BETWEEN '2004-08-12 00:00:00.000000' AND '2004-08-19 00:00:00.000000'

Every week I change the timestamp and make it between one week. Is there a default command for Timestamp in DB2 (like we have for DATE in Oracle like SYSDATE ) that I can use to get the weekly data.

I am trying to automate this process with the Data scheduler and am trying to remove the step for manually changing the dates everyweek.

I will really appreciate any replies in this regards.

Thanks
Raj
gh_amitava
Participant
Posts: 75
Joined: Tue May 13, 2003 4:14 am
Location: California
Contact:

Post by gh_amitava »

Hi,

You can use the query like this

select * from <table name> where <date> between current date -7 days and Current date;

Regards
Amitava
Post Reply