Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Last update date?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
John Poulakos

Active User


Joined: 13 Jun 2012
Posts: 125
Location: United States

PostPosted: Tue May 07, 2013 11:59 pm    Post subject: Last update date?
Reply with quote

Forgive me if this is a dumb question, but I don't know where to look:

Is there an easy way to tell when a table was last updated, maybe in the system tables or something?
Back to top
View user's profile Send private message

Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1567
Location: Andromeda Galaxy

PostPosted: Wed May 08, 2013 12:07 am    Post subject:
Reply with quote

Table update means the structure of the table or the records in the table?
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1790
Location: Bloomington, IL

PostPosted: Wed May 08, 2013 12:09 am    Post subject:
Reply with quote

I believe that the DBAs and application developers would have to collaborate on that, the DBAs providing a table with a "last updated" column, the developers in keeping it current for modified rows.
Back to top
View user's profile Send private message
John Poulakos

Active User


Joined: 13 Jun 2012
Posts: 125
Location: United States

PostPosted: Wed May 08, 2013 12:30 am    Post subject:
Reply with quote

I meant records in the table. I thought there might be a better way than check for a last changed date column.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed May 08, 2013 10:49 am    Post subject:
Reply with quote

Just being nit-picky - there are rows in the DB2 Tables.

What release of DB2 are you using at your shop? By "updated", you did not mean - "loaded"?

With DB2 9.1 and above -- UPDATESTATSTIME in Real time statistics tables gets updated about 30 minutes after the last update/insert/delete/reorg. If you want "accuracy" - possibly this is not what you need; if accuracy is not concern - this might serve the purpose.

In DB 9 there is also a hidden row change timestamp even when you didn't define a column for it - issue a SELECT statement with the ROW CHANGE TIMESTAMP column in the column list. If a qualifying row does not have a value for the ROW CHANGE TIMESTAMP column, DB2 returns the time that the page in which that row resides was updated.
Back to top
View user's profile Send private message
Raghuraman_New

New User


Joined: 03 Oct 2008
Posts: 43
Location: Chennai,India.

PostPosted: Wed May 08, 2013 12:43 pm    Post subject: Reply to: Last update date?
Reply with quote

John,
You can get the last updated time of a table using the SYSIBM.SYSTABLESPACESTATS table. You can get the info by using NAME(Table space name of the table) in SYSIBM.SYSTABLESPACESTATS.
Back to top
View user's profile Send private message
John Poulakos

Active User


Joined: 13 Jun 2012
Posts: 125
Location: United States

PostPosted: Wed May 08, 2013 11:28 pm    Post subject: Reply to: Last update date?
Reply with quote

Thanks a lot! Those last 2 answers will give me everything I need.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Thu May 09, 2013 1:13 pm    Post subject:
Reply with quote

Glad, we had been helpful.

Good Luck!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts refresh data from production - update... jzhardy DB2 1 Mon May 06, 2019 5:06 pm
No new posts Need suggestion on CICS READ UPDATE subratarec CICS 8 Fri May 03, 2019 2:23 pm
No new posts SQL to retrieve latest Eff date and then vinu78 DB2 8 Tue Apr 30, 2019 3:45 pm
No new posts how to add date & timestamp to th... dharmaraok DFSORT/ICETOOL 5 Thu Apr 18, 2019 2:45 pm
No new posts HEADER1 with Date arithmetic Martin-2000 DFSORT/ICETOOL 4 Thu Feb 21, 2019 3:24 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us