SELECT TABLENAME, LASTUPDATED FROM ( SELECT B.NAME AS 'TABLENAME', MAX(STATS_DATE (ID,INDID)) AS LASTUPDATED FROM SYS.SYSINDEXES AS A INNER JOIN SYS.OBJECTS AS B ON A.ID = B.OBJECT_ID WHERE B.TYPE = 'U' AND STATS_DATE (ID, INDID) IS NOT NULL GROUP BY B.NAME ) AS A ORDER BY LASTUPDATED DESC
A really useful bit SQL!
No comments:
Post a Comment