Delete records based on TIMESTAMP from a tabel

IBM's flagship relational database management system
shaikfayaz
Posts: 2
Joined: Wed Nov 26, 2008 7:08 pm
Skillset: PL/I,DB2.CICS,VSAM,JCL
Referer: Google Srch

Delete records based on TIMESTAMP from a tabel

Postby shaikfayaz » Thu Nov 27, 2008 2:45 pm

Hi

I created a tabel whose one of the column value is UPDATE_TIMESTAP this time stamp will be the value when the record has been laoded into the tabel(for example: today if i load a record at 12PM value(UPDATED_TIMESTAMP) loads into table is 2008-11-27-12.33.27.238657)

So now i want issue a delete query where All the records having (UPDATE_TIMESTAMP + 24 months) > TODAY’s date must be deleted from the tabel. i have a confusion with the value loaded and current timestamp valueloaded is in the format of (2008-11-27-12.33.27.238657) and current timestamp is 20081127123327238657 how can i compare both value for deleting the record from table..

FYI i coded as:

EXEC SQL DELETE FROM PENDTABL WHERE UPDATE_TIMESTAMP > CUREENT_TIMESTAMP - 24months ;

  • Similar Topics
    Replies
    Views
    Last post