Update statistics, last rundate

Oopps! Upgrade your browser pretty please.Oopps! Upgrade your browser pretty please.

Ever thought you’d wanted to have all the last update statistics run date/time for a table of choice. Not just the index-based, but all statistics at once?

Just issue a SELECT using the STATS_DATE () function, something like this following code, which I stumbled over in books online strolling for another problems solution: SELECT name AS stats_name, STATS_DATE(object_id, stats_id) AS statistics_update_date FROM sys.stats WHERE object_id = OBJECT_ID('[dbo].[]'); GO Or maybe you are satisfied with the statistics of just the indecies? SELECT name AS index_name, STATS_DATE(object_id, index_id) AS statistics_update_date FROM sys.indexes WHERE object_id = OBJECT_ID('[dbo].[your user table]'); GO Those are quite handy to have with you in your T-SQL performance black belt tool box.

Of course, you could just look it up in books online where I found them, but there are rare cases where you just can’t get to a books online fast enough (like sitting on a production server connection without BOL installed, and the managers are shouting at you to ”fix it, just fix it now!”).