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.
Author |
Topic |
alejo46
Posting Yak Master
157 Posts |
Posted - 2014-06-26 : 12:38:05
|
Good afternoon, i need your help pleasehow can i list out the older user tables, older than six months ago ?is there any query on the system catalog ?tne above question is because we need to know which older tables need to backup an then dropped them, so is for manteinance reasons thanks in advanced |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2014-06-26 : 13:43:33
|
quote: Originally posted by alejo46 Good afternoon, i need your help pleasehow can i list out the older user tables, older than six months ago ?is there any query on the system catalog ?tne above question is because we need to know which older tables need to backup an then dropped them, so is for manteinance reasons thanks in advanced
Did you mean user tables that were created/modified six months ago or earlier, or did you mean user tables in which the latest date on which the data was updated or queried is six months ago or earlier?If it is the former, you can do a select from sys.tables. There is a create_date and modified_date column.If it is the latter, unless you have some kind of auditing that indicates when the data was accessed, you cannot determine when it was last accessed. |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2014-06-27 : 03:23:54
|
An audit is a dependable method , but you could use sys.dm_db_index_usage_stats , keep in mind this DMV is refereshed after a SQL Server restart - http://www.sqlserver-dba.com/2007/11/sysdm_db_index_.htmlJack Vamvas--------------------http://www.sqlserver-dba.com |
|
|
alejo46
Posting Yak Master
157 Posts |
Posted - 2014-06-27 : 11:56:07
|
ok thanks you very much for your support, both choices are useful for what i need |
|
|
|
|
|
|
|