Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Find tables unused since last SQL Server restart

By Ryan McCauley,

This script will return a list of user tables in the database, along with the last time a SELECT was executed against them (including any views that include data from that table). This can be used to determine if a table is not in use anymore.

Statistics are reset when the SQL Server sevice is restarted, so this query will only return activity since that time. Also, just because there's no activity doesn't mean it's safe to remove an object - some tables may only be used during monthly or annual processes, and so they wouldn't show any activity except during those brief intervals.

Total article views: 5265 | Views in the last 30 days: 4
 
Related Articles
FORUM

Active Directory

Adding active directory groups

FORUM

SQL Server 2005 on active active cluster.

SQL Server 2005 on active active cluster.

FORUM

ACtive-ACtive Clustering SQL server 2005

ACtive-ACtive Clustering SQL server 2005

FORUM

Jeffrey Williams= Active/Active node question

Jeffrey Williams=Active/Active node question

FORUM

ACtive-ACtive Clustering SQL server 2005

ACtive-ACtive Clustering SQL server 2005

Tags
 
Contribute