Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Is there a quick tsql I can use to check when was the last time a dbreindex, index defrag and update stats was executed on the database?

Appreciate everyone's quick response.

share|improve this question

migrated from stackoverflow.com Nov 8 '13 at 10:46

This question came from our site for professional and enthusiast programmers.

    
Are they scheduled tasks? –  KeyboardFriendly Nov 8 '13 at 0:59

1 Answer 1

up vote 0 down vote accepted

Try one of the queries below and see if that is what you are looking for:

SELECT OBJECT_NAME(OBJECT_ID) AS DatabaseName, last_system_update,*
FROM sys.dm_db_index_usage_stats
WHERE database_id = DB_ID( 'YourDb')
AND OBJECT_ID=OBJECT_ID('YourTable')


select name as index_name,
         stats_date( object_id, index_id) as stats_update_date
from  sys.indexes
where object_id = object_id('YourTable');


Select * 

From sys.dm_db_index_usage_stats
share|improve this answer
    
Awesome! This works perfectly. Thank you! –  user2885241 Nov 10 '13 at 6:04
    
You Are Welcome –  KeyboardFriendly Nov 11 '13 at 23:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.