Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 last date table was updated

Author  Topic 

jassie
Constraint Violating Yak Guru

332 Posts

Posted - 2012-07-30 : 15:44:56
In a sql server 2008 r2 database, I am using a table called 'appclose' as a reference table. This table has no triggers. Can you tell me if there is a way I can tell when the last time the data was modified in the table?

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2012-07-30 : 15:56:24
You cannot, unless you have already set up CDC or custom auditing.

You might try dm_db_index_usage_stats. It *might* give you an accurate time. But, I don't think it's guaranteed.

SELECT 
OBJECT_NAME(OBJECT_ID) AS DatabaseName,
last_user_update,
*
FROM
sys.dm_db_index_usage_stats
WHERE
database_id = DB_ID('DatabaseName')
AND OBJECT_ID=OBJECT_ID('TableName')

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-07-30 : 16:05:48
quote:
Originally posted by jassie

In a sql server 2008 r2 database, I am using a table called 'appclose' as a reference table. This table has no triggers. Can you tell me if there is a way I can tell when the last time the data was modified in the table?


does it have a conventional audit trail column. I know chances are very dull without an audit trail trigger but checking just in case

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

jassie
Constraint Violating Yak Guru

332 Posts

Posted - 2012-08-01 : 11:47:30
thanks!
Go to Top of Page
   

- Advertisement -