I want to retrieve the last time table was updated(insert,delete,update).
I tried this query.
SELECT last_user_update
FROM sys.dm_db_index_usage_stats
WHERE object_id=object_id('T')
but the data there is not persisted across service restarts.
I want to preserve the stats even if the service restarts. How can I achieve it?
To persist audit data regarding data modifications, you will need to implement a DML Trigger on each table that you are interested in. You will need to create an Audit table, and add code to your triggers to write to this table.
For more details on how to implement DML triggers, refer to this MDSN article http://msdn.microsoft.com/en-us/library/ms191524%28v=sql.105%29.aspx
Find last time of update on a table
If you're talking about last time the table was updated in terms of its structured has changed (new column added, column changed etc.) - use this query:
If you're talking about DML operations (insert, update, delete), then you either need to persist what that DMV gives you on a regular basis, or you need to create triggers on all tables to record that "last modified" date - or check out features like Change Data Capture in SQL Server 2008 and newer.
this is help to get table modify with table name
Why not just run this: No need for special permissions
If you want to see data updates you could use this technique with required permissions: