View previous topic :: View next topic
|
Author |
Message |
cmsmoon
New User
Joined: 17 Jun 2010 Posts: 75 Location: Chennai
|
|
|
|
Is possible to get the last timestamp using db2 query,which updated tables using program/tep'2 ? |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Do you wanted to know the timestamp when record was updated or the timestamp when record was table was updated ?
But both the timestamp cant be retreived via sql unless you have some process of storing those timestamp in a DB2 table |
|
Back to top |
|
|
cmsmoon
New User
Joined: 17 Jun 2010 Posts: 75 Location: Chennai
|
|
|
|
Yes ,Extactly..
But i do not have Timestamp field in that table |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Dear cmsmoon,
Quote: |
Do you wanted to know the timestamp when record was updated or the timestamp when record was updated ? |
With all due respect to you reminding you gently that You did not answer this question yet
But anyway what you could do is try the following options
Alter the table by adding a new field of datatype TIMESTAMP and update it with the CURRENT TIMESTAMP when updating the table
so you can qury the table for MAX(TIMESTAMP) to know the latest update happened
or if you just need it for reporting purpose and dont bother to refer it in future you can generate the X(26) programmatically |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Dear Pandora,
Quote: |
Do you wanted to know the timestamp when record was updated or the timestamp when record was table was updated ? |
With all due respect, the 'or' portion of the question is confusing. |
|
Back to top |
|
|
cmsmoon
New User
Joined: 17 Jun 2010 Posts: 75 Location: Chennai
|
|
|
|
Sorry for confusion.
I tried the below query ,but it support only ver 9 and above
SELECT * FROM TAB
WHERE ROW CHANGE TIMESTAMP FOR TAB <= CURRENT TIMESTAMP AND
ROW CHANGE TIMESTAMP FOR TAB >= CURRENT TIMESTAMP - 30 days; |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Dave,
The quote is editted |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Pandora,
Quote: |
Do you wanted to know the timestamp when record was updated or the timestamp when record was updated ? |
Now both sides of the 'or' ask the same question? |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
I realised it by the time I elapsed the grace time of correcting things
All I wanted to ask was if TS wants the timestamp when the table is updated or the timestamp when record for a key is updated |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Hi cmsmoon,
Suggest you describe what your actual requirement is... That might help the experts here to suggest an appropriate solution...
cmsmoon wrote: |
Sorry for confusion.
I tried the below query ,but it support only ver 9 and above
SELECT * FROM TAB
WHERE ROW CHANGE TIMESTAMP FOR TAB <= CURRENT TIMESTAMP AND
ROW CHANGE TIMESTAMP FOR TAB >= CURRENT TIMESTAMP - 30 days; |
What version of DB2 are you using ?
You have used ROW CHANGE TIMESTAMP - did you do any research to understand what is the functionality of that ? [I have not worked in DB2 now for the last 5 years but did a quick google and doesnt look to be fitting your 'problem' ] |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
Is possible to get the last timestamp using db2 query,which updated tables using program/tep'2 ? |
If I understand correctly the TS wants to know <what> and <when> was updated using DSNTEP2 |
|
Back to top |
|
|
|