How to check when gather stats has been run on a db?

  • Hi,

    Is there a command can be used to check when gather stats has been run on a db?

    Thanks

     

  • SQL Server, may try this and LastUpdatedDate column will satisfy your needs 

    SELECT 'IndexName'   = QUOTENAME(SI.[Name], '['),

           'LastUpdatedDate'  = STATS_DATE(SI.[Id],SI.IndId)

    FROM  ..sysindexes AS SI

    WHERE SI.IndId BETWEEN 1 AND 254

     

  • Example above modified to include tablename

    SELECT 'TableName' = QUOTENAME(so.[Name], '['),

     'IndexName'   = QUOTENAME(si.[Name], '['),

           'LastUpdatedDate'  = STATS_DATE(si.[Id],si.IndId)

    FROM  sysindexes si inner join sysobjects so on so.id =  si.id

    WHERE si.IndId BETWEEN 1 AND 254

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply