2010. 6. 15. 06:27

T_SQL::미 사용 Table


미사용 Table 목록


SELECT  idx.object_id, OBJECT_NAME(IDX.object_id) as object_name,
        max(ps.row_count) as row_count,
        max(obj.create_date) as create_date,
        max(obj.modify_date) as modify_date
FROM sys.dm_db_index_usage_stats  AS DIS
       RIGHT OUTER JOIN sys.indexes AS IDX  ON DIS.object_id = IDX.object_id AND DIS.index_id = IDX.index_id
       JOIN sys.objects AS OBJ  ON IDX.object_id = OBJ.object_ID
       JOIN sys.dm_db_partition_stats as PS ON ps.object_id = OBJ.object_id
WHERE  OBJ.type IN ('U', 'V') AND DIS.object_id IS NULL
GROUP BY idx.object_id
ORDER BY OBJECT_NAME(IDX.object_id)

'T-SQL' 카테고리의 다른 글

[T-SQL] JOb 수행 시간 완료 계산  (0) 2010.07.19
Index::Defrag Script v4.0  (0) 2010.06.15
데이터베이스 사이즈  (0) 2010.06.04
T-SQL::Removing Duplication Data  (1) 2010.06.03