August 13, 2002 at 1:38 pm
Hello,
Does any one know of some T-SQL that returns a date time when a table was last accessed??? I need to clean up my SQL server and there are quite a number of tables that don't do anything.
Cheers,
Chris
August 15, 2002 at 2:11 am
I'd be interested in knowing this too.
My thoughts are maybe the statistics (if auto-generated) will have a last accessed date for a table. I guess if a table doesn't have any records then it's obsolete.
Maybe put a trigger on the tables to inform you of any usage, then get rid of the ones not used...
Just my thoughts tho...
Keith
"It makes me want to run around the Server Room in a Super-Hero Costume"
"It makes me want to run around the Server Room in a Super-Hero Costume"
August 15, 2002 at 2:58 am
Instead of a trigger you could run SQL profiler.
Regards,
Andy Jones
.
August 15, 2002 at 10:32 pm
Profiler is probably a better option. A trigger can't be put on a SELECT statement. However, some parsing is going to be required.
K. Brian Kelley
http://www.truthsolutions.com/
K. Brian Kelley
@kbriankelley
August 15, 2002 at 10:38 pm
Hello,
Thanks for your thoughts. I thought there would be some nice T-SQL to let me know when the table was last accessed without having to build up a history starting from today. If there was I would be able to happily remove the tables now.
I'm using Profiler to build up that history now and will query it in around a month to see what it gives me.
Thanks anyhow, always good to post here.
Chris
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply