devxlogo

October 26, 2017

Identifying Unused Tables with T-SQL

You can identify unused Tables in the following way: ; with Unused (TableName , RowCount, DateCreated, DateModified)AS (SELECT unusedTable.name AS TableName,PS.row_count AS RowCount,unusedTable.create_date AS DateCreated,unusedTable.modify_date AS DateModifiedFROM sys.all_objects UnusedTableJOIN sys.dm_db_partition_stats