Is there a way of finding out when the data was last entered into a table? I’m trying to find obsolete tables within my database and would like to know if there is a simple script(s) that I can run?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could try check the results of querying the sys.dm_db_index_usage_stats Dynamic Management View like this:
This will return things like the last_user_seek, scan and update dates on the indexes on the table.
Howvever, beware as the stats for the dynamic management view are reset when the server is restarted. The longer the server has been running, the more confidence you can have if the records show no activity.
I personally would also be checking all the source code to check for references to the table in question, and searching all sprocs/UDFs for references too (you can use SQL Search from Red Gate to do this – it’s free)