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

  • zxmgh

    SSC Eights!

    Points: 911

    Hi,

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

    Thanks

     

  • Ram Ram

    Ten Centuries

    Points: 1079

    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

     

  • Shawn Wilson

    Ten Centuries

    Points: 1161

    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 3 (of 3 total)

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