Identify records modified based on time

This is a discussion on Identify records modified based on time within the db2-udb forums in Other Databases category; I have a small requirement where by I want to retrieve all the records in a table modified since last 24 hours. Can anyone please help me out with this query? Is this possible? TIA....

Go Back   Database Forum > Other Databases > db2-udb

Database Forums

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 09-25-2007, 01:15 AM
Default Identify records modified based on time

I have a small requirement where by I want to retrieve all the records in a table modified since last 24 hours. Can anyone please help me out with this query?

Is this possible?

TIA.

Reply With Quote
  #2  
Old 09-25-2007, 05:52 AM
Default Re: Identify records modified based on time

godsonr-at-vsnl.net wrote:

> I have a small requirement where by I want to retrieve all the records in
> a table modified since last 24 hours. Can anyone please help me out with
> this query?


You have to add a column to the table which stores the time of the last
modification. The values in that column can be maintained by triggers.
Then you can query the table and filter based on that column.

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Reply With Quote
  #3  
Old 09-25-2007, 05:50 PM
Default Re: Identify records modified based on time

You would need to add a column that contains the timestamp of the last
UPDATE, and then create a TRIGGER on UPDATE to put in the current
timestamp. You could then select the rows that have a timestamp within
the last 24 hours.

You could do the same thing with a TRIGGER on INSERT to capture any rows
inserted in the last 24 hours.

godsonr-at-vsnl.net wrote:
> I have a small requirement where by I want to retrieve all the records in a table modified since last 24 hours. Can anyone please help me out with this query?
>
> Is this possible?
>
> TIA.
>

Reply With Quote
Reply


Thread Tools
Display Modes



All times are GMT -4. The time now is 05:52 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Integrated by bbpixel2009 :: jvbPlugin R1013.368.1

Search Engine Friendly URLs by vBSEO 3.1.0
vB Ad Management by =RedTyger=
In an effort to better serve ads to our visitors, cookies are used on Mydatabasesupport.com. For more information, check out our Privacy Policy.