We have very large database and today we want to search the tables which are used mostly. Means tables which are used in Procedures, Constraints, Views, Triggers etc. I know this is very strange requirement, but we need to do this. So, I tried to make an query which will help me to find out the top most tables used in other objects as I mentioned Let me share that sp with all of you: SELECT TableName, COUNT(*) So, I made my life easy, by using this. I can get the list if Tables which are used most. Let me know if it helps you in any way. |
Learn SQL and database management at SQLYoga for articles, tutorials, and tips to improve your skills and streamline data operations. Join our community!
yes It helped me to find the tables that mostly used.
ReplyDeletenice!!!
DeleteThank you sir for this script.
ReplyDeleteVery helpful...thanks!
ReplyDeletethats so good, i complemented your article querying the sys.dm_db_index_usage_stats DMV, because you could cover the adhoc queries
ReplyDeletehi
ReplyDeletei use this select but i have a problem.
how can i save this information before server reset or is shutdown.
because information in sys.dm_db_index_usage_stats be deleted in server rest.
please help me.
thank you